Selling mechanism
This commit is contained in:
19
Game/Accesories/deleter.gd
Normal file
19
Game/Accesories/deleter.gd
Normal 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
|
Reference in New Issue
Block a user