Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
franco-lapalma authored Oct 4, 2024
1 parent 2febd9c commit 4d52430
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
32 changes: 32 additions & 0 deletions example.wlk
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
object nave {
var vida = 1
var position = game.at(40,2)

method position() = position

method position(newPos) {
position = newPos
}

method image() = "nave.jpg"

method disparar(){

}
}

class Bala{

method image() = "bala.jpg"

var position = nave.position()

method position() = position
method position(newPos) {
position = newPos
}
method recorrido(){


}
}
38 changes: 38 additions & 0 deletions mainExample.wpgm
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import example.*
import wollok.game.*

program meteoricSpace{
game.title("nave")
game.height(25)
game.width(70)
game.boardGround("fondo4.jpg")

game.addVisual(nave)

keyboard.right().onPressDo({
nave.position(nave.position().right(1))

})

keyboard.left().onPressDo({
nave.position(nave.position().left(1))
})

keyboard.up().onPressDo({
nave.position(nave.position().up(1))
})

keyboard.down().onPressDo({
nave.position(nave.position().down(1))

})
game.onTick(500,"disparo",{
const proyectil = new Bala()

game.addVisual(proyectil)
proyectil.position(proyectil.position().up(1))
})
game.start()
}

//generar clase posicion

0 comments on commit 4d52430

Please sign in to comment.