feat: shield
This commit is contained in:
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user