diff options
author | azoooooo <118elemente@gmail.com> | 2018-06-10 17:33:06 +0200 |
---|---|---|
committer | azoooooo <118elemente@gmail.com> | 2018-06-10 17:33:06 +0200 |
commit | 3008aa047ed8425c0e3783a84381acc497316121 (patch) | |
tree | c8acbd546b3bb10726af6cfd532fcb11821d569a /src/main/kotlin/de/romjaki | |
parent | dea3ed0b7303356064f159e495a7f4da5b377082 (diff) | |
download | pluggabledino-3008aa047ed8425c0e3783a84381acc497316121.tar.gz pluggabledino-3008aa047ed8425c0e3783a84381acc497316121.tar.bz2 pluggabledino-3008aa047ed8425c0e3783a84381acc497316121.zip |
added counter
Diffstat (limited to 'src/main/kotlin/de/romjaki')
-rw-r--r-- | src/main/kotlin/de/romjaki/pluggabledino/states/GameState.kt | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/kotlin/de/romjaki/pluggabledino/states/GameState.kt b/src/main/kotlin/de/romjaki/pluggabledino/states/GameState.kt index 805632c..7ac5fa1 100644 --- a/src/main/kotlin/de/romjaki/pluggabledino/states/GameState.kt +++ b/src/main/kotlin/de/romjaki/pluggabledino/states/GameState.kt @@ -15,9 +15,11 @@ 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() } @@ -30,13 +32,19 @@ class GameState : BasicGameState() { lateinit var world: GameWorld + var count: Int = 0 + override fun getID(): Int = GAME override fun render(container: GameContainer?, game: StateBasedGame?, g: Graphics?) { + + g!! + g.scale(WIDTH_RATIO, HEIGHT_RATIO) + g.drawStringCentered((count / 100).toString(), WIDTH / 2f, HEIGHT / 2f) g.background = Color.white if (world.hurt) { g.background = Color.red |