How do I get this animation to play when switching layouts

  • Ok so I have an event that goes

    -Go to Layout "Hospital"

    -Play Animation "default"

    But it doesnt work, it should play the animation when it moves

    I have the event sheet in, it is the correct animation and its really annoying since im almost done

    Thanks in advance if someone has any ideas

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Check out this post:

  • Hey there ,

    When you go to the new layout, I think the "Play Animation" action doesn't come along for the ride.

    It will probably try to play the animation in the layout that you're leaving.

    I think you may need to set up an event that will run as soon as the next layout starts.

    You probably can't just say "On start of layout" play animation X, because you don't want it to happen every time that layout starts.

    So, the event will need to know if you wanted to play the animation when you left the previous layout.

    There are a bunch of ways to pass this kind of information between layouts.

    Global variables are one way. If you create a variable and place it at the root event level (not under a parent event), then anything you set that variable to will carry over between layout changes. This will do the job, but it can get a bit ugly if you have a bunch of trivial values being passed around with global variables.

    Another way is to create a Dictionary object (which is global by default). Any values you set in it will be accessible everywhere.

    So, when leaving the first layout, you would set a global-ish variable like "readyToPlayAnimAtStart" to 1.

    Then, at the start of the next layout, another event says:

    Event:

    + On start of layout,

    + Global-ish variable "readyToPlayAnimAtStart" equals 1

    Play animation X.

    Set Global-ish variable "readyToPlayAnimAtStart" back to 0.

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