restart after death

This commit is contained in:
Fabien Freling 2021-08-15 00:12:24 +02:00
parent ccb55f766e
commit d9a73bddb3
2 changed files with 13 additions and 2 deletions

View file

@ -7,7 +7,7 @@ Limitation: the player must cheat
- [ ] game over & restart
- [ ] sound effects
- [ ] background music
- [ ] score overlay
- [X] score overlay
- [ ] stage 1
- [ ] stage ending
- [ ] win state

View file

@ -510,7 +510,8 @@ class Game is TIC{
}
OVR() {
if (Game.state == Game.game) {
if (Game.state == Game.game ||
Game.state == Game.gameover) {
TIC.print("SCORE: %(__score)", 0, 0, Color.white, true)
TIC.print("GOAL: 12", 120, 0, Color.white, true)
}
@ -529,6 +530,13 @@ class Game is TIC{
_p_index = 0
}
} else if (Game.state == Game.gameover) {
if (TIC.btnp(4)) {
_world = World.new()
__state = Game.game
}
} else if (Game.state == Game.pause) {
if (TIC.btnp(5)) {
__state = Game.game
@ -585,6 +593,9 @@ class Game is TIC{
} else if (Game.state == Game.game) {
_world.draw()
} else if (Game.state == Game.gameover) {
_world.draw()
} else if (Game.state == Game.pause) {
TIC.print("PAUSE", 90, H/4, Color.white, false, 2)