mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48: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 {
|
if ni < 0 || ni >= b.size || nj < 0 || nj >= b.size {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
tt := b.tileAt(ni, nj)
|
tt := tileAt(nextTiles, ni, nj)
|
||||||
if tt == nil {
|
if tt == nil {
|
||||||
ii = ni
|
ii = ni
|
||||||
jj = nj
|
jj = nj
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
nt := tileAt(nextTiles, ni, nj)
|
if t.value != tt.value {
|
||||||
if t.value == tt.value && (nt == nil || !merged[nt]) {
|
break
|
||||||
|
}
|
||||||
|
if !merged[tt] {
|
||||||
ii = ni
|
ii = ni
|
||||||
jj = nj
|
jj = nj
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user