Added multiple skills

This commit is contained in:
2024-02-13 21:04:35 +01:00
parent 7937645028
commit cf155d9aab
5 changed files with 43 additions and 23 deletions

View File

@ -11,7 +11,7 @@ var skip: int
func _ready():
var player := owner as Player
player.dashed.connect(dash)
player.attacked.connect(attack)
player.skill_used.connect(use_skill)
movement = player.find_child("Movement")
animation_player = $AnimationPlayer
@ -24,6 +24,11 @@ func _process(_delta):
animation_player.play(next_animation)
if animation_player.current_animation == "human/spin":
animation_player.speed_scale = 2.0
else:
animation_player.speed_scale = 1.0
func play_movement():
if !movement:
play(RESET)
@ -41,8 +46,12 @@ func play_movement():
func dash():
play_with_duration("human/roll", 1.0)
func attack():
play_with_duration("human/slash", 1.0)
func use_skill(slot: int):
match slot:
0:
play_with_duration("human/spin", 0.9)
1:
play_with_duration("human/slash", 1.0)
func play(action_name: StringName):
next_animation = action_name