Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | tgryffyn |
First, apologies, I’m brand new to Godot. Looks super slick, though. I thought I’d help a friend with his Godot project and think I got things how they’re supposed to work, but I’m vexed by this one issue. I’ll try to explain it as succinctly as possible.
He wants to do a combo attack system. Basically if you press the attack button again, before the first sequence is done, you move to the second sequence in the combo. The basic flow is:
attack button → play anim1 → anim1 finishes without button press, cancel combo
attack button → play anim1 → attack button before anim end → play anim2 → etc
Basing this off of his code, so if things are in the wrong place, it might be his fault But things SHOULD work.
Here’s the flow:
Inside func _physics_process:
if Input.is_action_just_pressed(“Light_Attack”):
playback.travel(“punch_1”)
punch_1 is 28 seconds long. At 25 seconds, function Combo_End() is called (dumb function name, will rename later)
Inside Combo_End(), it checks various things like what combo sequence you’re on, etc.
Everything works correctly except the playback.travel(“punch_2”) INSIDE Combo_End()
I put a print() before and after it, those output just fine. I check playback.is_playing() and it’s true. I had seen something about .travel not working if the state machine wasn’t running or something.
I tried playback.start() instead, I tried re-instantiating playback inside Combo_End() but it seems that playback is global so it should be working.
playback.travel() seems to work fine in _physics_process so I could bend over backwards a little and make it all work there, but I wanted to know why playback.travel() didn’t work inside a function.
Thanks in advance!
-Trevor
PS:
onready var main_anim_tree = get_node(“Main_Anim_Tree”)
onready var playback = $Main_Anim_Tree.get(“parameters/playback”)