summaryrefslogtreecommitdiff
path: root/src/main/kotlin/de/romjaki/pluggabledino
diff options
context:
space:
mode:
authorazoooooo <118elemente@gmail.com>2018-06-10 17:33:06 +0200
committerazoooooo <118elemente@gmail.com>2018-06-10 17:33:06 +0200
commit3008aa047ed8425c0e3783a84381acc497316121 (patch)
treec8acbd546b3bb10726af6cfd532fcb11821d569a /src/main/kotlin/de/romjaki/pluggabledino
parentdea3ed0b7303356064f159e495a7f4da5b377082 (diff)
downloadpluggabledino-3008aa047ed8425c0e3783a84381acc497316121.tar.gz
pluggabledino-3008aa047ed8425c0e3783a84381acc497316121.tar.bz2
pluggabledino-3008aa047ed8425c0e3783a84381acc497316121.zip
added counter
Diffstat (limited to 'src/main/kotlin/de/romjaki/pluggabledino')
-rw-r--r--src/main/kotlin/de/romjaki/pluggabledino/states/GameState.kt8
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