the-crypt/script/WandPosition.gd

19 lines
527 B
GDScript3
Raw Normal View History

2020-07-18 15:58:23 -05:00
extends Position2D
2020-07-19 19:15:43 -05:00
onready var parent = get_parent()
2020-07-18 15:58:23 -05:00
func clear_conduit():
for c in get_children():
c.queue_free()
func set_current_conduit(conduit):
clear_conduit()
add_child(conduit.instance())
2020-07-19 18:36:36 -05:00
func _process(delta):
2020-07-19 23:06:56 -05:00
if Input.is_action_pressed("shoot") and get_child_count() != 0 and parent.Stats.energy > 0 and not parent.Inventory.open:
var energy_cost = get_children()[0].fire(get_parent().Inventory.active_projectile)
2020-07-19 19:15:43 -05:00
if energy_cost != null:
parent.energy -= energy_cost
parent.Stats.interrupt_regen()