-
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
2febd9c
commit 4d52430
Showing
2 changed files
with
70 additions
and
0 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 |
---|---|---|
@@ -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(){ | ||
|
||
|
||
} | ||
} |
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 |
---|---|---|
@@ -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 |