Skip to content

Commit

Permalink
Archivo.wlk Movimiento
Browse files Browse the repository at this point in the history
  • Loading branch information
LucianoSantinoValenzuelaMaltas committed Oct 22, 2024
1 parent 914af0b commit 06eea91
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 16 deletions.
31 changes: 30 additions & 1 deletion enemigos.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,33 @@ object lineaEnemiga{
game.addVisual(enemigo)
enemigo.moverseH(4,13)
}
}
}

/*
import movimiento.*
class Enemigos inherits FiguraConMovimiento(position = game.at(1,2)){
//var property position = game.at(4,16)
const tiempo
var lado = 0
method image() = "piopio.png"
method moverseH(){
game.onTick(tiempo, self, {self.position(game.at(self.position().x().randomUpTo(self.position().x()+1), self.position().y().randomUpTo(self.position().y()+1)))})
}
method limpiarEnemigos(){
game.removeVisual(self)
}
}
object lineaEnemiga{
var property enemigo1 = new Enemigos(tiempo = 500)
method activar(){
game.addVisual(enemigo1)
enemigo1.moverseH()
}
}
*/
18 changes: 3 additions & 15 deletions jugador.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,12 @@ import muros.*

import menus.menuPerdiste

object jugador {
var position = game.at(1,1)
import movimiento.*

method jugador() = true

method position() = position

method equisCorrecta(equis) = equis >= 1 && equis <= (game.width()-2)
object jugador inherits FiguraConMovimiento(position = game.at(1, 1)) {

method yeCorrecta(ye) = ye >= 1 && ye <= (game.height()-2)

method position(posicion){
if(self.equisCorrecta(posicion.x()) && self.yeCorrecta(posicion.y()) && !escenario.mismaPosicion(posicion)){
position = game.at(posicion.x(), posicion.y())
}
method jugador() = true

}
method posicionate(){
self.position(game.at(1, 1))
game.addVisualCharacter(self)
Expand All @@ -34,7 +23,6 @@ object jugador {

method eliminate(){
game.removeVisual(self)
//menuPerdiste.cargar()
}
}

Expand Down
18 changes: 18 additions & 0 deletions movimiento.wlk
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import muros.*



class FiguraConMovimiento{
var position
method position() = position

method equisCorrecta(equis) = equis >= 1 && equis <= (game.width()-2)

method yeCorrecta(ye) = ye >= 1 && ye <= (game.height()-2)

method position(posicion){
if(self.equisCorrecta(posicion.x()) && self.yeCorrecta(posicion.y()) && !escenario.mismaPosicion(posicion)){
position = game.at(posicion.x(), posicion.y())
}
}
}

0 comments on commit 06eea91

Please sign in to comment.