Using tilemaplayer as grid
This commit is contained in:
@@ -31,17 +31,24 @@ var cell := Vector2.ZERO:
|
||||
# a signal, and start the cooldown timer that will limit the rate
|
||||
# at which the cursor moves when we keep the direction key held
|
||||
# down
|
||||
position = grid.calculateMapPosition(cell)
|
||||
# global_position = grid.calculateMapPosition(cell)
|
||||
global_position = GroundLayer.map_to_local(cell)
|
||||
print("Position is ", position)
|
||||
emit_signal("moved", cell)
|
||||
_timer.start()
|
||||
|
||||
@onready var _timer: Timer = $Timer
|
||||
|
||||
@onready var Map: Node = $"../../Map"
|
||||
@onready var GroundLayer: TileMapLayer = $"../../Map/Ground"
|
||||
|
||||
func _ready() -> void:
|
||||
# Map = get_parent().get_parent().get_node("Map")
|
||||
# GroundLayer = Map.get_node("Ground")
|
||||
#
|
||||
_timer.wait_time = ui_cooldown
|
||||
position = grid.calculateMapPosition(cell)
|
||||
#position = grid.calculateMapPosition(cell)
|
||||
position = GroundLayer.map_to_local(cell)
|
||||
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
|
||||
Reference in New Issue
Block a user