diff options
Diffstat (limited to 'src')
5 files changed, 23 insertions, 2 deletions
diff --git a/src/main/kotlin/de/romjaki/pluggabledino/assets.kt b/src/main/kotlin/de/romjaki/pluggabledino/assets.kt index 6a0e600..42d3016 100644 --- a/src/main/kotlin/de/romjaki/pluggabledino/assets.kt +++ b/src/main/kotlin/de/romjaki/pluggabledino/assets.kt @@ -26,3 +26,5 @@ val buttonImage = Image(TextureLoader.getTexture("PNG", FileInputStream("assets/ val groundline = Image(TextureLoader.getTexture("PNG", FileInputStream("assets/images/groundline.png"))) val cactusImg = Image(TextureLoader.getTexture("PNG", FileInputStream("assets/images/cactus.png"))) + +val BirdImg= Image(TextureLoader.getTexture("PNG", FileInputStream("assets/images/bird1.png")))
\ No newline at end of file diff --git a/src/main/kotlin/de/romjaki/pluggabledino/game/GameWorld.kt b/src/main/kotlin/de/romjaki/pluggabledino/game/GameWorld.kt index 21c0571..9c405f0 100644 --- a/src/main/kotlin/de/romjaki/pluggabledino/game/GameWorld.kt +++ b/src/main/kotlin/de/romjaki/pluggabledino/game/GameWorld.kt @@ -121,7 +121,7 @@ class GameWorld : ContactListener { if (delay < 0) { createCactus1() - delay = random.nextFloat() + rand(1, 3)-0.5f + delay = random.nextFloat() + rand(2, 3)-0.5f } cacti.forEach { diff --git a/src/main/kotlin/de/romjaki/pluggabledino/main.kt b/src/main/kotlin/de/romjaki/pluggabledino/main.kt index d92ba50..94d9444 100644 --- a/src/main/kotlin/de/romjaki/pluggabledino/main.kt +++ b/src/main/kotlin/de/romjaki/pluggabledino/main.kt @@ -26,6 +26,8 @@ const val MAINMENU = 1 const val SETTINGS = 3 const val GAME = 2 const val LOST = 4 +var lastscore = 0 +var highscore = 0 fun main(args: Array<String>) { PluginLoader.loadPlugins() diff --git a/src/main/kotlin/de/romjaki/pluggabledino/states/GameState.kt b/src/main/kotlin/de/romjaki/pluggabledino/states/GameState.kt index 7ac5fa1..7ac2aa9 100644 --- a/src/main/kotlin/de/romjaki/pluggabledino/states/GameState.kt +++ b/src/main/kotlin/de/romjaki/pluggabledino/states/GameState.kt @@ -16,7 +16,7 @@ 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 @@ -24,6 +24,12 @@ class GameState : BasicGameState() { world = GameWorld() } if (world.hurt) { + lastscore = count / 100 + if(lastscore > highscore){ + + highscore = lastscore + + } game!!.enterState(LOST) } world.update(delta / 1000f, container.input) diff --git a/src/main/kotlin/de/romjaki/pluggabledino/states/LostState.kt b/src/main/kotlin/de/romjaki/pluggabledino/states/LostState.kt index 20ccf96..cec408c 100644 --- a/src/main/kotlin/de/romjaki/pluggabledino/states/LostState.kt +++ b/src/main/kotlin/de/romjaki/pluggabledino/states/LostState.kt @@ -34,6 +34,17 @@ class LostState : BasicGameState() { g!! g.scale(WIDTH_RATIO, HEIGHT_RATIO) g.background = Color.lightGray + g.drawStringCentered(lastscore.toString(), WIDTH / 2f, HEIGHT /2f ) + g.drawStringCentered("Score:", WIDTH / 2f , HEIGHT / 2f - 40f ) + if(lastscore > highscore ) { + g.drawStringCentered("NEUER HIGHSCORE:" + highscore, WIDTH / 2f, HEIGHT / 2f - 70f) + } + else { + + g.drawStringCentered("Highscore:" + highscore, WIDTH / 2f, HEIGHT / 2f - 70f) + + } + back.draw(g) playAgain.draw(g) } |