How do I pause and restart different animations of one sprite?

0 favourites
  • 8 posts
From the Asset Store
Adjusting the game screen for different resolutions (Letterbox scale)
  • Hi,

    In my game, you have to roast pancakes from both sides. For this, I made an "upside" and a "downside" animation, in which the sides slowly gets brown.

    If the player touches the pancake, the pancake should turn around. The side which is not in contact with the pan should pause at the actual frame and start from that frame, if being turned again.

    I tried to solve it something like this:

    -stop "uspide" animation

    -change to "downside"

    -start "downside" animation

    But both animations are behaving equally and dont stop and start at the respective frames.

    Is it solvable with one instance?

    Can anyone help me out?

    Thanks a lot,


  • Can you share your capx?

  • Hi,

    this is the section where the magic should happen. If you do a swipe-gesture above the pankace (here: "Grillgut") it should turn around, pause animation and so on. Enough information?


    EDIT: I managed to store the animation frame to a variable which works fine for one instance. But as there are multiple instances on the screen, the one stored frame number does not fit the next instance. Hmmm, tricky.

  • I have an idea that each pancake you will have variables to store the current frame for the side and the state of pancake is facing up or not.

    pancake have instance variable :

    - facedown_frame (number)

    - faceup_frame (number)

    - isFaceUp (Boolean)

    => For Each pancake

    If isFaceUp = true :

    >> add 1 to facedown_frame

    >> Set pancake frame to Self.facedown_frame

    If isFaceUp = false:

    >> add 1 to faceup_frame

    >> Set pancake frame to Self.faceup_frame

    Just my idea when thinking about your issue.

  • Hi,

    I think, i solved it. Just had a idea similar to yours. I gave the pancake two instance variables and so I can store the frame-number to the specific instances. I have to try out a little more but I'm confident so far.

    If it works out, I will post the code later.

    Thanks for thinking with me!


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Glad to know.

    I hope I could play your game soon.


  • Don't know, if anyone can comprehend, but here's my solution. Thanks again!

  • There are many ways you could do that but, check my, there you will find lot's info and tutorial, you will find out how to use it.


    you have a player animation with; Walk Right, Left, up, down, here what you should do is name your all animation like below;






    now create Instance Text Variable and name it

    Player_DIR and Right

    now open your code window and type in

    start of layout


    Player animation (ID_) player.DIR

    what you just have done is give a variable to player DIRECTION with Player.Player.DIR

    now when you want to change direction just use, say you want to walk UP and you want to change animation to UP, all you do is

    Player.player.dir "up"

    player animation (ID_) player.player.DIR

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