Reworked weapons and projectiles
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
class_name AbstractPlasmaWeapon
|
||||
extends AbstractWeapon
|
||||
|
||||
|
||||
@onready var sprite : AnimatedSprite2D = $AnimatedSprite2D
|
||||
@onready var cooldown_timer : Timer = $CooldownTimer
|
||||
|
||||
func _ready() -> void:
|
||||
sprite.play(IDLE_ANIMATION)
|
||||
|
||||
|
||||
func shoot(ship_velocity: Vector2) -> bool:
|
||||
var is_shot := super.shoot(ship_velocity)
|
||||
if is_shot:
|
||||
sprite.play(SHOT_ANIMATION)
|
||||
_can_shoot = false
|
||||
cooldown_timer.start()
|
||||
|
||||
return is_shot
|
||||
|
||||
|
||||
func _on_animated_sprite_2d_animation_finished() -> void:
|
||||
sprite.play(RELOAD_ANIMATION)
|
||||
|
||||
|
||||
func _on_cooldown_timer_timeout() -> void:
|
||||
sprite.play(IDLE_ANIMATION)
|
||||
_can_shoot = true
|
||||
Reference in New Issue
Block a user