From d7ae050e7dc27fa052a9f4dbf065fdb86a966967 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Fri, 19 Nov 2021 14:25:21 +0100 Subject: HexBoard -> HexMap --- addons/hexgrid/HexMap.gd | 2 +- demo/Map.gd | 18 +++++++++--------- project.godot | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/addons/hexgrid/HexMap.gd b/addons/hexgrid/HexMap.gd index 3da1631..f2a62c7 100644 --- a/addons/hexgrid/HexMap.gd +++ b/addons/hexgrid/HexMap.gd @@ -1,7 +1,7 @@ #warning-ignore-all:integer_division extends Node -class_name HexBoard, "res://addons/hexgrid/HexMap.png" +class_name HexMap, "res://addons/hexgrid/HexMap.png" enum Orientation { E=1, NE=2, N=4, NW=8, W=16, SW=32, S=64, SE=128 } diff --git a/demo/Map.gd b/demo/Map.gd index abfc231..ca2a927 100644 --- a/demo/Map.gd +++ b/demo/Map.gd @@ -16,7 +16,7 @@ const MOUNT : String = "res://demo/assets/mountain.png" var drag : Sprite -var board : HexBoard +var board : HexMap var prev : Vector2 var hexes : Dictionary var hex_rotation : int @@ -75,10 +75,10 @@ func configure() -> void: v0 -= ts / 2 if v: hex_rotation = 30 - board = HexBoard.new(10, 4, 100, v0, false, funcref(self, "get_tile")) + board = HexMap.new(10, 4, 100, v0, false, funcref(self, "get_tile")) else: hex_rotation = 0 - board = HexBoard.new(10, 7, 100, v0, true, funcref(self, "get_tile")) + board = HexMap.new(10, 7, 100, v0, true, funcref(self, "get_tile")) func texture_size() -> Vector2: return texture.get_size() @@ -137,12 +137,12 @@ func get_tile(coords : Vector2, k : int) -> Tile: func get_road(k : int) -> int: if not board.v: return 0 var v : int = 0 - v += (HexBoard.Orientation.E if k in [19,20,21,23,24,42,43,44,45,46,47] else 0) - v += (HexBoard.Orientation.W if k in [19,20,21,22,24,25,43,44,45,46,47] else 0) - v += (HexBoard.Orientation.SE if k in [22,32,42,52,62] else 0) - v += (HexBoard.Orientation.NW if k in [32,42,52,62] else 0) - v += (HexBoard.Orientation.NE if k in [7,16,25,32] else 0) - v += (HexBoard.Orientation.SW if k in [7,16,23] else 0) + v += (HexMap.Orientation.E if k in [19,20,21,23,24,42,43,44,45,46,47] else 0) + v += (HexMap.Orientation.W if k in [19,20,21,22,24,25,43,44,45,46,47] else 0) + v += (HexMap.Orientation.SE if k in [22,32,42,52,62] else 0) + v += (HexMap.Orientation.NW if k in [32,42,52,62] else 0) + v += (HexMap.Orientation.NE if k in [7,16,25,32] else 0) + v += (HexMap.Orientation.SW if k in [7,16,23] else 0) return v func notify(pos : Vector2, coords : Vector2) -> void: diff --git a/project.godot b/project.godot index e89d9c0..cbb10de 100644 --- a/project.godot +++ b/project.godot @@ -15,7 +15,7 @@ _global_script_classes=[ { "path": "res://demo/Hex.gd" }, { "base": "Node", -"class": "HexBoard", +"class": "HexMap", "language": "GDScript", "path": "res://addons/hexgrid/HexMap.gd" }, { @@ -36,9 +36,9 @@ _global_script_classes=[ { } ] _global_script_class_icons={ "Hex": "res://addons/hexgrid/Tile.png", -"HexBoard": "", -"Piece": "", -"Tile": "", +"HexMap": "res://addons/hexgrid/HexMap.png", +"Piece": "res://addons/hexgrid/Piece.png", +"Tile": "res://addons/hexgrid/Tile.png", "Unit": "res://addons/hexgrid/Piece.png" } -- cgit v1.1-2-g2b99