Skip to content

Commit e4f0363

Browse files
committed
feat(player): @export of AnimationPlayer
1 parent 552536f commit e4f0363

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

objects/actors/player/Player.gd

+5-4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ var lifePoint = maxHealth
77

88
@onready var attackTimer = $AttackTimer
99
@onready var healthbar = $HealthBar
10+
@onready var animation_player: AnimationPlayer = $AnimationPlayer
1011

1112
@export var weapon: Weapon
1213
var hasChest = false
@@ -31,11 +32,11 @@ func apply_attack(force: int) -> void:
3132
return
3233

3334
lifePoint -= force
34-
$AnimationPlayer.play('Hit')
35+
animation_player.play('Hit')
3536
healthbar.value = lifePoint
3637

3738
if (lifePoint == 0):
38-
$AnimationPlayer.play("Death")
39+
animation_player.play("Death")
3940

4041
func get_speed():
4142
if hasChest: return _speed * chestModifierSpeed
@@ -66,6 +67,6 @@ func _on_collecting(element):
6667
if element is Boat:
6768
if hasChest:
6869
element.can_enter = true
69-
$AnimationPlayer.play("FadeAway")
70+
animation_player.play("FadeAway")
7071

71-
if element.can_enter: $AnimationPlayer.play("FadeAway")
72+
if element.can_enter: animation_player.play("FadeAway")

0 commit comments

Comments
 (0)