blocks: Bug fix: only one operation for a piece is permitted

This commit is contained in:
Hajime Hoshi 2016-02-16 03:59:49 +09:00
parent 805b637a18
commit 10d191b8b1

View File

@ -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 {