Skip to content

Commit

Permalink
only check poly children
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidZajicek committed Mar 3, 2023
1 parent 4a3f022 commit 5027fb9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/InfiniteModeMain.gd
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,12 @@ func _on_Poly_destroyed(_score: int):

func test_if_legal(_polyomino: Polyomino, _position: Vector2):
for poly in _polyomino.get_children():
var grid_pos = snapped((poly.position + _position) / Globals.tile_size, Vector2(1, 1))
if not grid.rect.has_point(grid_pos):
return false
if grid.bitmap.get_bitv(grid_pos):
return false
if poly is Poly:
var grid_pos = snapped((poly.position + _position) / Globals.tile_size, Vector2(1, 1))
if not grid.rect.has_point(grid_pos):
return false
if grid.bitmap.get_bitv(grid_pos):
return false
return true

func test_for_any_legal_moves():
Expand Down

0 comments on commit 5027fb9

Please sign in to comment.