blob: 20ccf964ce17c871bc99f960058adffc356f34d8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
package de.romjaki.pluggabledino.states
import de.romjaki.pluggabledino.*
import de.romjaki.pluggabledino.api.Button
import org.newdawn.slick.Color
import org.newdawn.slick.GameContainer
import org.newdawn.slick.Graphics
import org.newdawn.slick.state.BasicGameState
import org.newdawn.slick.state.StateBasedGame
class LostState : BasicGameState() {
override fun init(container: GameContainer?, game: StateBasedGame?) {
game!!
playAgain.addClickHandler {
game.enterState(GAME)
}
back.addClickHandler {
game.enterState(MAINMENU)
}
}
override fun update(container: GameContainer?, game: StateBasedGame?, delta: Int) {
playAgain.update(container!!.input)
back.update(container.input)
}
override fun getID(): Int =
LOST
val back = Button("Back to Main Menu", WIDTH / 2f, HEIGHT / 2f + 50)
val playAgain = Button("PLAY AGAIN", WIDTH / 2f, HEIGHT / 2f + 100)
override fun render(container: GameContainer?, game: StateBasedGame?, g: Graphics?) {
g!!
g.scale(WIDTH_RATIO, HEIGHT_RATIO)
g.background = Color.lightGray
back.draw(g)
playAgain.draw(g)
}
}
|