@altria said in Playing animation from a specific keyframe:
Does that mean it doesn't return -1 if you run it later down the blocks?
It returns -1 in any place
Update on my post that's being analyzed: I found out about AnimationPlayer.speed_scale searching on google now everything is working just fine! Thank you!
new code:
func update_gun(): if Input.is_action_just_pressed("fire") and anim_player.is_playing() == false and cocked == true: shoot() cocked = false elif Input.is_action_just_pressed("fire") and anim_player.is_playing() == false: hammer_debug = true anim_player.speed_scale = 1.0 anim_player.play(trigger_cock) anim_player.connect("animation_finished", func on_anim_finish(anim_name): if anim_name == trigger_cock and hammer_debug == true: shoot() ) if Input.is_action_just_released("fire") and anim_player.current_animation == trigger_cock: hammer_debug = false anim_player.speed_scale = -1.0 func _process(_delta): update_gun()Just added a little debounce so the animation ending while going backwards don't call the shoot function.