feat"redhood interaction and sword getting
This commit is contained in:
@ -11,6 +11,7 @@ var jump_velocity = 400.0
|
||||
@export_range(0, 10, 0.1, "or_greater")
|
||||
var gravity_modifier = 1
|
||||
|
||||
@onready var sword: AnimatedSprite2D = $Sword
|
||||
@onready var damageable: Damageable = $Damageable
|
||||
@onready var shield: AnimatedSprite2D = $Shield
|
||||
@onready var base: AnimatedSprite2D = $Base
|
||||
@ -60,7 +61,6 @@ func _physics_process(delta: float) -> void:
|
||||
velocity.x = move_toward(velocity.x, 0, speed)
|
||||
move_and_slide()
|
||||
return
|
||||
|
||||
|
||||
if not is_on_floor():
|
||||
velocity += get_gravity() * delta * gravity_modifier
|
||||
@ -88,9 +88,16 @@ func _physics_process(delta: float) -> void:
|
||||
velocity.x = clampf(velocity.x, -speed, speed)
|
||||
else:
|
||||
velocity.x = move_toward(velocity.x, 0, speed)
|
||||
|
||||
|
||||
if Input.is_action_just_pressed("hit") and has_sword:
|
||||
hit()
|
||||
|
||||
move_and_slide()
|
||||
|
||||
func hit():
|
||||
print("hit")
|
||||
current_animation = "hit"
|
||||
|
||||
func _on_dialogue_manager_dialogue_ended() -> void:
|
||||
set_in_play()
|
||||
|
||||
@ -104,7 +111,14 @@ func _on_npc_shield_dialogue_dialogue_ended() -> void:
|
||||
set_in_play()
|
||||
current_sprite.visible = false
|
||||
current_sprite = shield
|
||||
shield.play("idle")
|
||||
shield.visible = true
|
||||
current_sprite.play("idle")
|
||||
current_sprite.visible = true
|
||||
has_shield = true
|
||||
|
||||
|
||||
func _on_red_hood_sword_dialogue_dialogue_ended() -> void:
|
||||
set_in_play()
|
||||
current_sprite.visible = false
|
||||
current_sprite = sword
|
||||
current_sprite.play("idle")
|
||||
current_sprite.visible = true
|
||||
has_sword = true
|
||||
|
Reference in New Issue
Block a user