You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
Townodoro/node_2d.gd

16 lines
496 B

extends Node2D
@onready var highlight: Sprite2D = $highlight
@onready var ground: TileMapLayer = $Ground
@onready var objects: TileMapLayer = $Objects
var selected = Vector2i(0, 0)
func _input(event: InputEvent) -> void:
if event is InputEventMouseMotion:
selected = ground.local_to_map(event.position)
highlight.position = ground.map_to_local(selected)
if event is InputEventMouseButton:
if event.button_index == MOUSE_BUTTON_LEFT:
objects.set_cell(selected, 37, Vector2i(0, 0))