diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2020-07-10 10:09:53 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2020-07-10 10:09:53 +0200 |
commit | e4284124ddfad218e989602bc46affc5492b0850 (patch) | |
tree | e49752fa6857042b76c8b540737f789d774feef6 /HexBoard.gd | |
parent | d1d300a06222cc30d8ffac7d3c2d5da90b042bcf (diff) | |
download | godot-hexgrid-e4284124ddfad218e989602bc46affc5492b0850.zip godot-hexgrid-e4284124ddfad218e989602bc46affc5492b0850.tar.gz |
fix adjacents()
Diffstat (limited to 'HexBoard.gd')
-rw-r--r-- | HexBoard.gd | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/HexBoard.gd b/HexBoard.gd index b890cc0..aa5d8e9 100644 --- a/HexBoard.gd +++ b/HexBoard.gd @@ -91,7 +91,7 @@ func _key(x : int, y : int) -> int: i += (int(cr.x) - 1) return i -func adjacents(coords : Vector2) -> Array: +func build_adjacents(coords : Vector2) -> Array: adjacents.clear() coords.x += 1 adjacents.append(get_tile(coords)) @@ -100,8 +100,9 @@ func adjacents(coords : Vector2) -> Array: coords.x -= 1 adjacents.append(get_tile(coords)) coords.x -= 1 + coords.y -= 1 adjacents.append(get_tile(coords)) - coords.y -= 2 + coords.y -= 1 adjacents.append(get_tile(coords)) coords.x += 1 adjacents.append(get_tile(coords)) @@ -349,7 +350,6 @@ func compute_contact(from : Vector2, to : Vector2, o : int, t : Vector2, line : return Vector2(from.x + (y - from.y) / n, y) else: if line: -# o = 1 var p : float = im if (o == Orientation.SE or o == Orientation.NW) else -im var k : float = 0 if o == Orientation.SW or o == Orientation.NW: k = t.y - (p * (t.x + s)) |