-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0d4b43b
commit e401899
Showing
3 changed files
with
24 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,26 @@ | ||
import zombie.* | ||
object generadorDeEnemigos { | ||
var nombreEnemigo = 0 | ||
const enemigo = #{} | ||
var nombreEnemigo = 0 /*asigno el nombre a los enemigos que voy creando segun numeros, asi puedo crear nombres nuevos | ||
automaticamente*/ | ||
|
||
const enemigo = #{}/*contiene cada enemigo que fue creando*/ | ||
|
||
method nombre() = nombreEnemigo | ||
method sumarEnemigo() { | ||
method nombre() = nombreEnemigo /*para poder consultar el ultimo nombre usado*/ | ||
method sumarEnemigo() { /*suma 1 a nombre enemigo para asi crear enemigos nuevos, luego hay que hacer la funcion | ||
para que reste 1 cuando maten a un enemigo*/ | ||
nombreEnemigo+=1 | ||
} | ||
method generarEnemigo(numero){ | ||
if (numero==1) { | ||
var nombreParaEnemigo = self.nombre() | ||
method generarEnemigo(numero){/*segun el numero ingresado, se generara un tipo de enemigo distinto*/ | ||
if (numero==1) {/*generara un zombie normal*/ | ||
var nombreParaEnemigo = self.nombre() /* esto esta hecho porque sino wollok se enoja, | ||
para poder crear un enemigo*/ | ||
nombreParaEnemigo = new ZombiesNormales() | ||
enemigo.add(nombreParaEnemigo) | ||
return game.addVisual(nombreParaEnemigo) | ||
enemigo.add(nombreParaEnemigo)/*se añade a la lista de enemigos activos*/ | ||
return game.addVisual(nombreParaEnemigo)/*muestra al enemigo en el juego*/ | ||
} | ||
return 0 | ||
} | ||
method moverEnemigos() { | ||
enemigo.forEach({zombie => zombie.movete()}) | ||
enemigo.forEach({zombie => zombie.movete()})/*aplica la funcion movete a cada enemigo de la coleccion*/ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters