mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
tvintris: fix else cases
This commit is contained in:
parent
8178e1f7da
commit
8bc94947e5
@ -398,6 +398,7 @@ fn main() {
|
||||
game.handle_jhat(jh, jv, joyid)
|
||||
game2.handle_jhat(jh, jv, joyid)
|
||||
}
|
||||
else {}
|
||||
}
|
||||
}
|
||||
if should_close {
|
||||
@ -445,6 +446,7 @@ fn (game mut Game) handle_key(key int) {
|
||||
match key {
|
||||
C.SDLK_SPACE { action = .space }
|
||||
game.k_fire { action = .fire }
|
||||
else {}
|
||||
}
|
||||
|
||||
if action == .space {
|
||||
@ -457,6 +459,7 @@ fn (game mut Game) handle_key(key int) {
|
||||
C.Mix_ResumeMusic()
|
||||
game.state = .running
|
||||
}
|
||||
else {}
|
||||
}
|
||||
}
|
||||
|
||||
@ -466,6 +469,7 @@ fn (game mut Game) handle_key(key int) {
|
||||
game.init_game()
|
||||
game.state = .running
|
||||
}
|
||||
else {}
|
||||
}
|
||||
}
|
||||
if game.state != .running { return }
|
||||
@ -475,6 +479,7 @@ fn (game mut Game) handle_key(key int) {
|
||||
game.k_left { game.move_right(-1) }
|
||||
game.k_right { game.move_right(1) }
|
||||
game.k_down { game.move_tetro() } // drop faster when the player presses <down>
|
||||
else {}
|
||||
}
|
||||
}
|
||||
|
||||
@ -486,6 +491,7 @@ fn (game mut Game) handle_jbutton(jb int, joyid int) {
|
||||
mut action := Action(.idle)
|
||||
match jb {
|
||||
game.jb_fire { action = .fire }
|
||||
else {}
|
||||
}
|
||||
|
||||
if action == .fire {
|
||||
@ -494,6 +500,7 @@ fn (game mut Game) handle_jbutton(jb int, joyid int) {
|
||||
game.init_game()
|
||||
game.state = .running
|
||||
}
|
||||
else {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -510,6 +517,7 @@ fn (game mut Game) handle_jhat(jh int, jv int, joyid int) {
|
||||
game.jh_left { game.move_right(-1) }
|
||||
game.jh_right { game.move_right(1) }
|
||||
game.jh_down { game.move_tetro() } // drop faster when the player presses <down>
|
||||
else {}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user