How do I counter the tick delay for "on animation finished"

Get help using Construct 2

Post » Sun Apr 24, 2016 1:29 pm

Hello

So I am using a "on animation finished" trigger
I can't figure out how it's working really and I am confused.
It seems that 1 tick before the animation is actually finished, the event "on animation finished" is triggered
So in my case for example, I have :

On A "prejump" animation finished :
set A animation to "jumping"

then I have another condition saying :

when A "jumping" animation is playing
set A value to x

What happens is that during 1 tick, A still has "prejump" drawn on the screen but A value is already to x, but its animation is not set to "jumping" yet.

I tried to put everything in the same event like this :
On A "prejump" animation finished :
set A animation to "jumping"
set A value to x

But it does the same.
B
9
S
1
Posts: 60
Reputation: 611

Post » Sun Apr 24, 2016 2:52 pm

Do the first condition
On A "prejump" animation finished :
set A animation to "jumping"

Followed by a new condition
system > compare two values > first value 'A.AnimationName' equal to "jumping" > the set value action
else > set the value differend

Assuming that there will be only 1 A playing those animations.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sun Apr 24, 2016 4:05 pm

Ah yea
thanks so much !
B
9
S
1
Posts: 60
Reputation: 611

Post » Sun Apr 24, 2016 7:48 pm

Hey @99Instances2Go
So I had this whole thing working using your way, and then I just bumped into something crazy.
Basically I have copy pasted my thing and literally just changed the input, instead of using the controller it's using the keyboard now, for the exact same thing. But it wasn't working !!!!!!!

I have noticed that now it's changing the name of the animation on the same tick than the tick where you press the button, but both keyboard and controller are using the "on press" trigger. And when it is with the controller it's changing the animation the tick after you actually pressed the button.

Are the controllers and keyboard not behaving the same way ? is that a bug of Construct 2 ?

EDIT : ok yep, I just tried it in an empty project. If you make two sprites and switch their animation on a "on press button" trigger it is not going to change at the same tick depending of keyboard or controller
B
9
S
1
Posts: 60
Reputation: 611

Post » Sun Apr 24, 2016 9:53 pm

This is the difference between an actual trigger and a fake trigger.

"on key press" is an actual trigger and is triggered when the key is pressed.

"on button pressed" is a fake trigger and is the same as

"button is down"
"trigger once"

More info here:
bullet-spawning-from-non-existent-offset-due-to-speed_p913723?#p913723
B
92
S
32
G
110
Posts: 5,295
Reputation: 71,501

Post » Sun Apr 24, 2016 11:22 pm

okay!
Thank you so much @R0J0hound

well, that's very good to know that. I guess I can remove my bug topic then.
B
9
S
1
Posts: 60
Reputation: 611

Post » Mon Apr 25, 2016 5:14 pm

Hello @R0J0hound
And by the way, just curiosity but, is there any way of "simulating" a "real trigger" with events ? Like to fire an event like "on key pressed" does ?
B
9
S
1
Posts: 60
Reputation: 611

Post » Mon Apr 25, 2016 5:45 pm

Functions are the typical way to do that, unless you had something else in mind.
B
92
S
32
G
110
Posts: 5,295
Reputation: 71,501

Post » Tue Apr 26, 2016 9:35 am

Hello @R0J0hound

Yes, I mean a way to activate the event as soon as the trigger is triggered :
When you pause the game in debug mode, and trigger a "on key pressed" button, it will trigger the event and if there is an animation name to change or a variable to change, it will apply those actions at once.
Whereas with a function trigger or every else "fake triggers" such as trigger once, it will wait until the end of the current tick before applying the actions.
My question is : is there a way to reproduce the first behavior for another object with events ?

Also it brings me to another question :
I wonder if that's only me but, it seems that I can't make the events such as "key is down" working in debug mode although "button is down" works with the controller events. I guess this is related as well ?
B
9
S
1
Posts: 60
Reputation: 611

Post » Tue Apr 26, 2016 4:19 pm

That may just be a limitation of the debugger that "on key pressed" events still run when paused. Functions are actual triggers that will run right when you call them, but they won't be called when the debugger is paused.

I do not know with your second question. I do not have much experience dealing with input while in the debugger.
B
92
S
32
G
110
Posts: 5,295
Reputation: 71,501

Next

Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, valefor and 6 guests