feat: add basic game over state
This commit is contained in:
parent
53a31ea8ad
commit
6d15a806f6
1 changed files with 30 additions and 0 deletions
30
game/state/handlers/gameover.go
Normal file
30
game/state/handlers/gameover.go
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
package handlers
|
||||
|
||||
import (
|
||||
"tetris/engine/render"
|
||||
"tetris/game/state"
|
||||
|
||||
rl "github.com/gen2brain/raylib-go/raylib"
|
||||
)
|
||||
|
||||
type GameOver struct{}
|
||||
|
||||
func (GameOver) Enter() {
|
||||
}
|
||||
|
||||
func (GameOver) Exit() {
|
||||
}
|
||||
|
||||
func (GameOver GameOver) Update(fsm state.Transitioner, delta float32) {
|
||||
if rl.IsKeyPressed(rl.KeyEnter) {
|
||||
fsm.Switch("gameplay")
|
||||
} else if rl.IsKeyPressed(rl.KeyQ) {
|
||||
fsm.Switch("menu")
|
||||
}
|
||||
}
|
||||
|
||||
func (GameOver *GameOver) Render() {
|
||||
render.Begin(rl.Black)
|
||||
render.DrawText(250, 200, 32, "Game Over", rl.White)
|
||||
render.End()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue