0 votes

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 physicsprocess:
if Input.isactionjustpressed("LightAttack"):
playback.travel("punch_1")

punch1 is 28 seconds long. At 25 seconds, function ComboEnd() 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("punch2") INSIDE ComboEnd()

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 physicsprocess 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 mainanimtree = getnode("MainAnimTree")
onready var playback = $Main
Anim_Tree.get("parameters/playback")

in Engine by (12 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.