mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
blocks: Bug fix: only one operation for a piece is permitted
This commit is contained in:
parent
805b637a18
commit
10d191b8b1
@ -280,20 +280,16 @@ func (s *GameScene) Update(state *GameState) error {
|
||||
if state.Input.IsRotateRightTrigger() {
|
||||
s.currentPieceAngle = s.field.RotatePieceRight(piece, x, y, angle)
|
||||
moved = angle != s.currentPieceAngle
|
||||
}
|
||||
if state.Input.IsRotateLeftTrigger() {
|
||||
} else if state.Input.IsRotateLeftTrigger() {
|
||||
s.currentPieceAngle = s.field.RotatePieceLeft(piece, x, y, angle)
|
||||
moved = angle != s.currentPieceAngle
|
||||
}
|
||||
if l := state.Input.StateForLeft(); l == 1 || (10 <= l && l%2 == 0) {
|
||||
} else if l := state.Input.StateForLeft(); l == 1 || (10 <= l && l%2 == 0) {
|
||||
s.currentPieceX = s.field.MovePieceToLeft(piece, x, y, angle)
|
||||
moved = x != s.currentPieceX
|
||||
}
|
||||
if r := state.Input.StateForRight(); r == 1 || (10 <= r && r%2 == 0) {
|
||||
} else if r := state.Input.StateForRight(); r == 1 || (10 <= r && r%2 == 0) {
|
||||
s.currentPieceX = s.field.MovePieceToRight(piece, x, y, angle)
|
||||
moved = y != s.currentPieceX
|
||||
}
|
||||
if d := state.Input.StateForDown(); (d-1)%2 == 0 {
|
||||
} else if d := state.Input.StateForDown(); (d-1)%2 == 0 {
|
||||
s.currentPieceY = s.field.DropPiece(piece, x, y, angle)
|
||||
moved = y != s.currentPieceY
|
||||
if moved {
|
||||
|
Loading…
Reference in New Issue
Block a user