ANIMATION SEQUENCE HELP

0 favourites
  • 7 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • 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

  • Don't use two separate events.

    On space

    (sub-event) gvAnim=0, set gvAnim=1...

    Else ste gvAnim=0...

  • How can I set up sub events?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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:

    Keyboard->On Space pressed
    	swimmer->Set animation to swimmer.AnimationName = "swim1" ? "swim2" : "swim1"[/code:3i9n1x5x]
    but that is a slightly advanced use of [url=https://www.scirra.com/manual/78/expressions]expressions[/url]
  • Thanks. I can't seem to get the code to properly reference my animations though.

  • mfusaro - if you post your capx we can take a look and see if we can fix the issue.

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)