Godot Version
v4.5.1.stable.flathub [f62fdbde1]
Question
I’m creating a system that invokes things into the player for debug, i make a shield with a Area2D, i create a Node to put a script that help me load the scene i need and instantiate , i try to invoke every time a specific button presses, how i only invoke the shield (instantiate) just once, independent if i have the button pressed: this is my actual script:
const shield = preload(“res://scenes/actions/habilities/Shield.tscn”)
static func action(_player : player)
var escudo_load = shield.instantiate()
var pos_escudo = _player.get_node(“MarcadorPies”).global_position
escudo_load.position = pos_escudo
_player.get_parent().add_child(escudo_load)
and this is the button that invokes the node:
if Input.is_action_pressed(b_action) and charge_stat:
Invoker_debug.action(self)
If i keep the button pressed there are like hundreds of shields in the scene how i only make one shield and only one?