Added head-shooting and regeneration feature to player; added first

draft of Maggie's sounds.
This commit is contained in:
Henry 2026-02-11 15:04:59 +00:00
parent accc463791
commit 2cc08692fd
17 changed files with 470 additions and 54 deletions

View file

@ -6,7 +6,7 @@ signal damage_taken
# signal shield_ui
@export var speed: int = 150
@export var cooldown: float = 0.25
@export var cooldown: float = 1
@export var bullet_scene : PackedScene
@export var max_shield: int = 10
var shield: int = 0:
@ -36,7 +36,7 @@ func _ready():
func start():
print(shield)
shader_active = false
$Ship.frame = 1
$Ship.frame = 0
# $Ship/Boosters/BoosterBurst.hide()
# $Ship/Boosters.hide()
$Ship.show()
@ -57,13 +57,16 @@ func _process(delta):
var input = Input.get_vector("left", "right", "up", "down")
if input.x > 0:
$Ship.frame = 2
$Ship/Head.frame = 2
# $Ship/Boosters.animation = "right"
elif input.x < 0:
$Ship.frame = 0
$Ship.frame = 1
$Ship/Head.frame = 1
# $Ship/Boosters.animation = "left"
else:
$Ship.frame = 1
$Ship.frame = 0
$Ship/Boosters.animation = "forward"
$Ship/Head.frame = 0
position += input * speed * delta
position = position.clamp(Vector2(8, 8), screensize - Vector2(8, 8))
if Input.is_action_pressed("shoot"):
@ -74,6 +77,7 @@ func shoot():
return
can_shoot = false
$GunCooldown.start()
$Ship/Head.hide()
var b = bullet_scene.instantiate()
get_tree().root.add_child(b)
b.start(position + ship.position + Vector2(0, -10))
@ -98,6 +102,14 @@ func set_shield(value: int):
func _on_gun_cooldown_timeout() -> void:
$HeadInflate.play()
#tween.tween_property($Ship/Head, "scale", 4, 0.25)
#await tween.finished
await get_tree().create_timer(0.25).timeout
var tween = create_tween().set_parallel(false)
$Ship/Head.show()
tween.tween_property($Ship/Head, "scale", Vector2(2,2), .15).set_trans(Tween.TRANS_BOUNCE)
tween.tween_property($Ship/Head, "scale", Vector2(1,1), .10).set_trans(Tween.TRANS_BOUNCE)
can_shoot = true
func _on_area_entered(area):