How do I get this animation to trigger correctly? [SOLVED]

Get help using Construct 2

Post » Tue Jul 21, 2015 2:45 am

Enemy is supposed to charge up (PreDashFace... state) and then dash. When they collide with the edge marker, they should turn around and enter the PreDash state again. When facing right, the PreDash animation will not trigger. That is the only thing not working.

Gif of error
Image

Code of error
Image

Feel free to crit my code; I'm pretty new at this :oops:
Last edited by bclikesyou on Tue Jul 21, 2015 12:09 pm, edited 1 time in total.
B
42
S
11
G
1
Posts: 264
Reputation: 3,299

Post » Tue Jul 21, 2015 2:48 am

i have same big issue my anim states never can triger right.. so i think only way is to add variable numbers to pick which frame state to do and wait for one state to finish and change var trigger number and then when that number is a value another trigger.. finally changing to a finish state value which goes back to default ... ughhhhrrr I hope someone make example capx.... :(
B
3
Posts: 5
Reputation: 185

Post » Tue Jul 21, 2015 3:10 am

It's difficult to say without seeing a capx. However, I would start by adding a trigger once to lines 27 and 30 - you don't want those events firing every tick, they just need to happen once when the state changes.
A big fan of JavaScript.
B
74
S
20
G
71
Posts: 2,228
Reputation: 44,888

Post » Tue Jul 21, 2015 3:31 am

@Colludium Ah thanks!

And here is the .capx
B
42
S
11
G
1
Posts: 264
Reputation: 3,299

Post » Tue Jul 21, 2015 3:36 am

Cool - yeah, trigger once is often your friend for things like this!
A big fan of JavaScript.
B
74
S
20
G
71
Posts: 2,228
Reputation: 44,888

Post » Tue Jul 21, 2015 4:27 am

thx good work!
B
3
Posts: 5
Reputation: 185

Post » Tue Jul 21, 2015 12:14 pm

@Colludium Quick question: how did you know to use it with events 27 and 30 and not the others? I understand what Trigger Once does but I guess I'm confused as to when is appropriate to use it.
B
42
S
11
G
1
Posts: 264
Reputation: 3,299

Post » Tue Jul 21, 2015 1:09 pm

Of course. Remember that each event will run each tick if the condition is true; the exceptions being triggers and conditions with trigger once under them. The set animations with a wait of 2 seconds doesn't make logical sense if it runs every tick - 60 times per second a 2 second timer is started. I can't be sure how that caused the error because c2 reverts conditions when a wait is up and the wait was for longer than the travel time of the sprite, so all sorts of weird things could happen. Tldr - a wait running every tick will not work.
A big fan of JavaScript.
B
74
S
20
G
71
Posts: 2,228
Reputation: 44,888

Post » Tue Jul 21, 2015 1:30 pm

@Colludium Got it! Makes total sense now. Appreciate the help!
B
42
S
11
G
1
Posts: 264
Reputation: 3,299


Return to How do I....?

Who is online

Users browsing this forum: Blendi1223 and 35 guests