examples: fix 2048 gameplay (#14838)
parent
c10ba6d81a
commit
e5bbb23389
|
@ -787,7 +787,7 @@ fn (mut app App) undo() {
|
|||
fn (mut app App) on_key_down(key gg.KeyCode) {
|
||||
// these keys are independent from the game state:
|
||||
match key {
|
||||
.a { app.is_ai_mode = !app.is_ai_mode }
|
||||
.c { app.is_ai_mode = !app.is_ai_mode }
|
||||
.escape { app.gg.quit() }
|
||||
.n, .r { app.new_game() }
|
||||
.backspace { app.undo() }
|
||||
|
@ -797,6 +797,7 @@ fn (mut app App) on_key_down(key gg.KeyCode) {
|
|||
else {}
|
||||
}
|
||||
if app.state in [.play, .freeplay] {
|
||||
if !app.is_ai_mode {
|
||||
match key {
|
||||
.w, .up { app.move(.up) }
|
||||
.a, .left { app.move(.left) }
|
||||
|
@ -805,6 +806,7 @@ fn (mut app App) on_key_down(key gg.KeyCode) {
|
|||
else {}
|
||||
}
|
||||
}
|
||||
}
|
||||
if app.state == .victory {
|
||||
if key == .space {
|
||||
app.state = .freeplay
|
||||
|
|
Loading…
Reference in New Issue