ANIMATION SEQUENCE HELP

Get help using Construct 2

Post » Mon Jun 30, 2014 1:59 am

I want this script to switch between two different images every time the space bar is pressed, but this code just isn't working. Any ideas? http://i.imgur.com/FGhPDkm.png
B
4
S
1
Posts: 19
Reputation: 436

Post » Mon Jun 30, 2014 2:06 am

Don't use two separate events.
On space
(sub-event) gvAnim=0, set gvAnim=1...
Else ste gvAnim=0...
ImageImageImage
B
71
S
22
G
240
Posts: 3,732
Reputation: 133,990

Post » Mon Jun 30, 2014 5:12 pm

How can I set up sub events?
B
4
S
1
Posts: 19
Reputation: 436

Post » Mon Jun 30, 2014 5:31 pm

@mfusaro

To add a sub-event, right click the Event just to the left of the icon for the first condition and from the pop-up menu select Add->Add sub-event.

If you right click on the text of the condition you get a different pop-up menu without this option.

You can also drag events under and to the right of other events to make them a sub-event.

It's also possible to do this as a single event with a single action, without needing the global variable:
Code: Select all
Keyboard->On Space pressed
   swimmer->Set animation to swimmer.AnimationName = "swim1" ? "swim2" : "swim1"

but that is a slightly advanced use of expressions
Find all the Construct 2 games that were on Steam Greenlight here
B
33
S
9
G
7
Posts: 451
Reputation: 6,782

Post » Mon Jun 30, 2014 7:45 pm

Thanks. I can't seem to get the code to properly reference my animations though.
B
4
S
1
Posts: 19
Reputation: 436

Post » Tue Jul 01, 2014 3:26 pm

@mfusaro - if you post your capx we can take a look and see if we can fix the issue.
Find all the Construct 2 games that were on Steam Greenlight here
B
33
S
9
G
7
Posts: 451
Reputation: 6,782

Post » Tue Jul 01, 2014 5:32 pm

I made a quick capx for you.

When space is pressed in a sub event I check if swim1 animation is playing and change it for swim2,
then there's an else( it's not really necessary, but it avoids checking the other events in case the 1st one already was true) and if swim2 was playing it changes for swim1.

@OddConfection you just saved me from so much work. I didn't know I could use conditional events to setup values. I used to setup alot of unnecessary events/actions.
You do not have the required permissions to view the files attached to this post.
Please tag me with @caiorosisca if your post is refering to me :). I don't always follow the topics I answer.
B
11
S
4
G
1
Posts: 272
Reputation: 1,643


Return to How do I....?

Who is online

Users browsing this forum: adventurist, Blendi1223, PROxMTswatTR and 26 guests