1
Fork 0
mirror of https://github.com/Cookie-CHR/LD54-SPAce-ltd.git synced 2024-11-25 00:34:18 +00:00
space-ltd/Components/sprite_snap.gd
2023-10-15 18:46:50 +02:00

21 lines
411 B
GDScript

extends Node2D
@onready var _map = $TileMap
var min_x = 0
var min_y = 0
var max_x = 10
var max_y = 10
var max_border = 100
var prev_coord = null
func _process(_delta):
var mouse_pos = _map.local_to_map(get_global_mouse_position())
_map.set_cell(0, mouse_pos, 0, Vector2(1,0))
if prev_coord != null and prev_coord != mouse_pos:
_map.set_cell(0, prev_coord, 0, Vector2(0,0))
prev_coord = mouse_pos