Selling mechanism

This commit is contained in:
2025-04-29 14:29:25 +02:00
parent fc4285e99d
commit 0cc20ef435
10 changed files with 131 additions and 17 deletions

View File

@ -0,0 +1,19 @@
extends Node2D
const LIST_OF_ENTITIES = ["ArcherTower", "WizardTower", "MortarTower", "Mine", "StickTrap", "Wall"]
func _ready() -> void:
set_process_input(true)
func _process(delta: float) -> void:
position = get_viewport().get_mouse_position()
func _input(event):
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
if abs(position) <= get_viewport().get_mouse_position():
var list_of_entities = get_node("Area2D").get_overlapping_bodies()
for i in list_of_entities:
for j in LIST_OF_ENTITIES:
if i.get_parent().name.contains(j):
i.get_parent().queue_free()
queue_free()
pass