39 lines
794 B
GDScript
39 lines
794 B
GDScript
|
extends Node
|
||
|
|
||
|
enum TileType {
|
||
|
None,
|
||
|
Sand,
|
||
|
Grass
|
||
|
}
|
||
|
|
||
|
var HexPoints = null
|
||
|
var HexColors = []
|
||
|
|
||
|
export(Vector2) var hex_scale = Vector2(1, 1) setget set_hex_scale
|
||
|
|
||
|
# Called when the node enters the scene tree for the first time.
|
||
|
func _ready():
|
||
|
set_hex_scale(Vector2(32,32))
|
||
|
|
||
|
func set_hex_scale(scale):
|
||
|
hex_scale = scale
|
||
|
|
||
|
HexPoints = PoolVector2Array()
|
||
|
|
||
|
var NoneColors = PoolColorArray()
|
||
|
var SandColors = PoolColorArray()
|
||
|
var GrassColors = PoolColorArray()
|
||
|
|
||
|
for i in range (7):
|
||
|
var angle = (60 * i) * PI / 180
|
||
|
HexPoints.append(Vector2(cos(angle), sin(angle)) * hex_scale.x / 2)
|
||
|
NoneColors.append("#555555")
|
||
|
SandColors.append("#ffa106")
|
||
|
GrassColors.append("#4b9635")
|
||
|
|
||
|
HexColors = {
|
||
|
TileType.None: NoneColors,
|
||
|
TileType.Sand: SandColors,
|
||
|
TileType.Grass: GrassColors
|
||
|
}
|