mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
examples/2048: Refactoring
This commit is contained in:
parent
30a16cbcbe
commit
0a04ed1c22
@ -110,14 +110,16 @@ func (b *Board) Move(dir Dir) {
|
||||
if ni < 0 || ni >= b.size || nj < 0 || nj >= b.size {
|
||||
break
|
||||
}
|
||||
tt := b.tileAt(ni, nj)
|
||||
tt := tileAt(nextTiles, ni, nj)
|
||||
if tt == nil {
|
||||
ii = ni
|
||||
jj = nj
|
||||
continue
|
||||
}
|
||||
nt := tileAt(nextTiles, ni, nj)
|
||||
if t.value == tt.value && (nt == nil || !merged[nt]) {
|
||||
if t.value != tt.value {
|
||||
break
|
||||
}
|
||||
if !merged[tt] {
|
||||
ii = ni
|
||||
jj = nj
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user