This commit is contained in:
Hajime Hoshi 2014-01-07 23:29:12 +09:00
parent 7cea6f4bc8
commit 2b4dc28d91
3 changed files with 13 additions and 16 deletions

View File

@ -68,18 +68,15 @@ func (s *GameScene) Update(state *GameState) {
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
} }
if l := state.Input.StateForKey(ui.KeyLeft); if l := state.Input.StateForKey(ui.KeyLeft); l == 1 || (10 <= l && l%2 == 0) {
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
} }
if r := state.Input.StateForKey(ui.KeyRight); if r := state.Input.StateForKey(ui.KeyRight); r == 1 || (10 <= r && r%2 == 0) {
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
} }
if d := state.Input.StateForKey(ui.KeyDown); if d := state.Input.StateForKey(ui.KeyDown); (d-1)%2 == 0 {
(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
} }