the-crypt/script/BasicWand.gd

19 lines
556 B
GDScript3
Raw Normal View History

extends Sprite
onready var ShootDelay : Timer = $ShootDelay
2020-07-17 19:43:30 -05:00
onready var ProjectileSpawn : Position2D = $ProjectileSpawn
2020-07-17 19:18:59 -05:00
onready var Player = get_parent().get_parent()
2020-07-17 19:43:30 -05:00
var projectile_ps = Globals.WHITE_PROJECTILE_PS
func fire_projectile(rot):
2020-07-17 19:18:59 -05:00
if ShootDelay.is_stopped() and Player.energy != 0:
Player.Stats.interrupt_regen()
Player.energy -= 1
var temp = projectile_ps.instance()
get_tree().current_scene.add_child(temp)
temp.global_position = ProjectileSpawn.global_position
temp.rotation_degrees = rot
temp.launch()
2020-07-17 19:43:30 -05:00
ShootDelay.start()