I have a script in GDScript that contains a simple mouse position listener, and a set_cell
function that sets a cell. For some reason, when I set the cell on my simulation, it doesn't spawn. The mouse position is set correctly, and the set cell position, when set to (1, 1)
, works. But for some reason. This does not. Here is my code:
func _process(delta):
var mouse_pos = get_viewport().get_mouse_position()
var mx = mouse_pos.x
var my = mouse_pos.y
if Input.is_action_just_pressed("click"):
set_cell(mouse_pos.x, mouse_pos.y, 0)
If you find a mistake, feel free to tell me, otherwise, have a nice day, and I appreciate your time.