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 - [ ] game over & restart
- [ ] sound effects - [ ] sound effects
- [ ] background music - [ ] background music
- [ ] score overlay - [X] score overlay
- [ ] stage 1 - [ ] stage 1
- [ ] stage ending - [ ] stage ending
- [ ] win state - [ ] win state

View file

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