diff options
Diffstat (limited to 'src/main/kotlin/de/romjaki/pluggabledino/states/GameState.kt')
-rw-r--r-- | src/main/kotlin/de/romjaki/pluggabledino/states/GameState.kt | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/main/kotlin/de/romjaki/pluggabledino/states/GameState.kt b/src/main/kotlin/de/romjaki/pluggabledino/states/GameState.kt index 7ac2aa9..e579933 100644 --- a/src/main/kotlin/de/romjaki/pluggabledino/states/GameState.kt +++ b/src/main/kotlin/de/romjaki/pluggabledino/states/GameState.kt @@ -16,20 +16,17 @@ class GameState : BasicGameState() { override fun enter(container: GameContainer?, game: StateBasedGame?) { world = GameWorld() count = 0 + } override fun update(container: GameContainer?, game: StateBasedGame?, delta: Int) { count += delta + if (container!!.input.isKeyDown(Input.KEY_R)) { world = GameWorld() } if (world.hurt) { lastscore = count / 100 - if(lastscore > highscore){ - - highscore = lastscore - - } game!!.enterState(LOST) } world.update(delta / 1000f, container.input) @@ -61,6 +58,7 @@ class GameState : BasicGameState() { for (cactus in world.cacti) { g.drawImage(cactusImg, cactus.position.x * WIDTH / 50, cactus.position.y * HEIGHT / 50 - cactusImg.height) } - } + + } } |