feat: shield
All checks were successful
Create tag and build when new code gets to main / BumpTag (push) Successful in 6s
Create tag and build when new code gets to main / Export (push) Successful in 2m13s

This commit is contained in:
2025-08-02 21:34:08 +02:00
parent 12b02877bb
commit 02f04cc38a
6 changed files with 244 additions and 93 deletions

View File

@ -11,12 +11,18 @@ var jump_velocity = 400.0
@export_range(0, 10, 0.1, "or_greater")
var gravity_modifier = 1
@onready var damageable: Damageable = $Damageable
@onready var shield: AnimatedSprite2D = $Shield
@onready var base: AnimatedSprite2D = $Base
var current_sprite: AnimatedSprite2D
var is_in_cutscene = false # back to true on build
var current_animation = "idle"
var has_shield = false
var has_sword = false
var has_armor = false
func play_anim():
current_sprite.play(current_animation)
@ -60,6 +66,8 @@ func _physics_process(delta: float) -> void:
velocity += get_gravity() * delta * gravity_modifier
var direction := Input.get_axis("move_left", "move_right")
damageable.set_active(has_shield and direction != 0)
if direction > 0 and is_on_floor():
look_right()
if direction < 0 and is_on_floor():
@ -94,5 +102,9 @@ func _on_start_dancing() -> void:
func _on_npc_shield_dialogue_dialogue_ended() -> void:
set_in_play()
print("jget shield")
current_sprite.visible = false
current_sprite = shield
shield.play("idle")
shield.visible = true
has_shield = true