Animation help

Get help using Construct 2

Post » Sat Sep 12, 2015 4:51 pm

Hey guys, so I have an enemy that will simulate controls based on the X of the Player character, so that it will run towards the player.

Now I have it as a turret so when it's within a certain range of the player it will shoot and activate the shoot animation.. however it just stays on the shoot animation even when moving after the player again. It doesn't go back to the run animation when simulating left or right.

Thanks in advance!
B
4
Posts: 24
Reputation: 250

Post » Sat Sep 12, 2015 5:50 pm

Here are my events.

Image
B
4
Posts: 24
Reputation: 250

Post » Sat Sep 12, 2015 5:52 pm

use a variable with the name STATE and set the value of your sprite current state, for example when your sprite STATE its running -> set animation running , if your STATE its shooting -> set animation shooting.

https://www.scirra.com/manual/73/instance-variables
B
9
S
3
Posts: 142
Reputation: 1,108

Post » Sat Sep 12, 2015 6:06 pm

Majinboo wrote:use a variable with the name STATE and set the value of your sprite current state, for example when your sprite STATE its running -> set animation running , if your STATE its shooting -> set animation shooting.

https://www.scirra.com/manual/73/instance-variables


So would that take away the need for the Platform on moved - Animation = run ?

So instead it would be Platform on moved - Set STATE to run ?

Then

if STATE = Run - Play animation Run ?

Or instead would I not use the platform moved and set the STATE to run when I compare the X value of Hero? Like have it above with compare X Hero then simulate left/right ?
B
4
Posts: 24
Reputation: 250

Post » Sat Sep 12, 2015 6:16 pm

vengeancestudios wrote:
Majinboo wrote:use a variable with the name STATE and set the value of your sprite current state, for example when your sprite STATE its running -> set animation running , if your STATE its shooting -> set animation shooting.

https://www.scirra.com/manual/73/instance-variables


So would that take away the need for the Platform on moved - Animation = run ?

So instead it would be Platform on moved - Set STATE to run ?

Then

if STATE = Run - Play animation Run ?

Or instead would I not use the platform moved and set the STATE to run when I compare the X value of Hero? Like have it above with compare X Hero then simulate left/right ?


yes, use variables, each variable will contain the animation to run, Platform on moved - Set STATE to run
B
9
S
3
Posts: 142
Reputation: 1,108

Post » Sat Sep 12, 2015 6:30 pm

Ok, I did what you said and added a state as you can see from my events.. however he just stays in the 'Spit' animation once in range and again doesn't change back to run when moving in between spitting.

Image
B
4
Posts: 24
Reputation: 250

Post » Sat Sep 12, 2015 6:33 pm

because you need use variables in platform is jumping and platform on stopped, you cant have animations outside the variables, STATES = run, jumping, idle....
B
9
S
3
Posts: 142
Reputation: 1,108

Post » Sat Sep 12, 2015 6:40 pm

Ok I just set the states for each platform 'instance' and it didn't make a difference, he still just keeps repeating the 'spit' animation

Image
B
4
Posts: 24
Reputation: 250

Post » Sat Sep 12, 2015 7:07 pm

You can use On animation finished, set animation to idle.

Or On key released (Shoot button), set animation state to idle

Maybe check to see if you have the 'spit' animation set to loop, in animation properties.
B
9
S
3
Posts: 104
Reputation: 1,033

Post » Sat Sep 12, 2015 7:20 pm

Frostein wrote:You can use On animation finished, set animation to idle.

Or On key released (Shoot button), set animation state to idle

Maybe check to see if you have the 'spit' animation set to loop, in animation properties.


None of that worked. Also spit animation is not set to loop
B
4
Posts: 24
Reputation: 250

Next

Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 4 guests