Files
ScrapFrontier/game/entities/weapons/laser/laser_weapon.gd
T

25 lines
489 B
GDScript

extends AbstractWeapon
@onready var sprite : AnimatedSprite2D = $AnimatedSprite2D
@onready var cooldown_timer : Timer = $CooldownTimer
func set_belonging(belonging: Belonging) -> void:
super.set_belonging(belonging)
sprite.play(PREFIXES[_belonging])
func shoot(ship_velocity: Vector2) -> bool:
var is_shot := super.shoot(ship_velocity)
if is_shot:
_can_shoot = false
cooldown_timer.start()
return is_shot
func _on_cooldown_timer_timeout() -> void:
_can_shoot = true