mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +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() {
|
if state.Input.IsRotateRightTrigger() {
|
||||||
s.currentPieceAngle = s.field.RotatePieceRight(piece, x, y, angle)
|
s.currentPieceAngle = s.field.RotatePieceRight(piece, x, y, angle)
|
||||||
moved = angle != s.currentPieceAngle
|
moved = angle != s.currentPieceAngle
|
||||||
}
|
} else if state.Input.IsRotateLeftTrigger() {
|
||||||
if state.Input.IsRotateLeftTrigger() {
|
|
||||||
s.currentPieceAngle = s.field.RotatePieceLeft(piece, x, y, angle)
|
s.currentPieceAngle = s.field.RotatePieceLeft(piece, x, y, angle)
|
||||||
moved = angle != s.currentPieceAngle
|
moved = angle != s.currentPieceAngle
|
||||||
}
|
} else if l := state.Input.StateForLeft(); l == 1 || (10 <= l && l%2 == 0) {
|
||||||
if l := state.Input.StateForLeft(); l == 1 || (10 <= l && l%2 == 0) {
|
|
||||||
s.currentPieceX = s.field.MovePieceToLeft(piece, x, y, angle)
|
s.currentPieceX = s.field.MovePieceToLeft(piece, x, y, angle)
|
||||||
moved = x != s.currentPieceX
|
moved = x != s.currentPieceX
|
||||||
}
|
} else if r := state.Input.StateForRight(); r == 1 || (10 <= r && r%2 == 0) {
|
||||||
if r := state.Input.StateForRight(); r == 1 || (10 <= r && r%2 == 0) {
|
|
||||||
s.currentPieceX = s.field.MovePieceToRight(piece, x, y, angle)
|
s.currentPieceX = s.field.MovePieceToRight(piece, x, y, angle)
|
||||||
moved = y != s.currentPieceX
|
moved = y != s.currentPieceX
|
||||||
}
|
} else if d := state.Input.StateForDown(); (d-1)%2 == 0 {
|
||||||
if d := state.Input.StateForDown(); (d-1)%2 == 0 {
|
|
||||||
s.currentPieceY = s.field.DropPiece(piece, x, y, angle)
|
s.currentPieceY = s.field.DropPiece(piece, x, y, angle)
|
||||||
moved = y != s.currentPieceY
|
moved = y != s.currentPieceY
|
||||||
if moved {
|
if moved {
|
||||||
|
Loading…
Reference in New Issue
Block a user