summaryrefslogtreecommitdiffstats
path: root/Map.gd
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2020-07-15 10:55:47 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2020-07-15 10:55:47 +0200
commit594a82b45e5d9dcd90faad8fa4f8eb42b2c981b6 (patch)
treef44fbc21362e79fb8f9c987b542406cb7d61ca71 /Map.gd
parent9274d1351f527de8ccee89eaccea1cf5dc141756 (diff)
downloadgodot-hexgrid-594a82b45e5d9dcd90faad8fa4f8eb42b2c981b6.zip
godot-hexgrid-594a82b45e5d9dcd90faad8fa4f8eb42b2c981b6.tar.gz
add zoom buttons, support one button mouse, add font
Diffstat (limited to 'Map.gd')
-rw-r--r--Map.gd5
1 files changed, 4 insertions, 1 deletions
diff --git a/Map.gd b/Map.gd
index 5a4da33..d23ea5a 100644
--- a/Map.gd
+++ b/Map.gd
@@ -87,7 +87,7 @@ func on_mouse_move() -> void:
if drag != null:
drag.position = get_local_mouse_position()
-func on_click(pressed : bool) -> void:
+func on_click(pressed : bool) -> bool:
var pos : Vector2 = get_local_mouse_position()
var coords : Vector2 = board.to_map(pos)
if pressed:
@@ -97,6 +97,8 @@ func on_click(pressed : bool) -> void:
drag = $Tank
elif board.to_map($Target.position) == coords:
drag = $Target
+ else:
+ return true
else:
if drag:
if board.is_on_map(coords):
@@ -111,6 +113,7 @@ func on_click(pressed : bool) -> void:
else:
if coords == prev and board.is_on_map(coords):
change_tile(coords, pos)
+ return false
func change_tile(coords : Vector2, pos : Vector2) -> void:
var hex : Hex = board.get_tile(coords)