27 lines
574 B
GDScript
27 lines
574 B
GDScript
|
extends Node2D
|
||
|
|
||
|
|
||
|
export(Vector2) var pos = Vector2.ZERO setget setget_pos
|
||
|
var view_camera = null setget set_view_camera
|
||
|
|
||
|
# Called when the node enters the scene tree for the first time.
|
||
|
func _ready():
|
||
|
pass # Replace with function body.
|
||
|
|
||
|
|
||
|
func setget_pos(value: Vector2):
|
||
|
update()
|
||
|
pos = value
|
||
|
return value
|
||
|
|
||
|
|
||
|
func set_view_camera(value: Camera2D):
|
||
|
view_camera = value
|
||
|
return view_camera
|
||
|
|
||
|
|
||
|
func _draw():
|
||
|
var coords = Globals.HexGrid.get_hex_center (pos)
|
||
|
draw_set_transform(coords, 0, Vector2.ONE)
|
||
|
draw_polyline(HexTileDrawer.HexPoints, "#f00", 2 * view_camera.zoom.x)
|