I am working on a farming game, but I dont want to add crops to the same position or overwrite it. How can i prevent the overwrite part?
func _input(event):
if event.is_action_pressed("Plant") and self.get_cellv(tile_pos_infront_of_player) == CONSTANTS.SCRATCH_DIRT_ID:
var crop_path = "res://Crops/Potato.tscn"
var crop = load(crop_path).instance()
crop.initialize(crop_data)
crop.global_position = tile_pos_infront_of_player * 16
add_child(crop)
If you need more information for code let me know