End of animation

0 favourites
  • 12 posts
From the Asset Store
3 pixel charaters with over 8 animations each + animations with a gun
  • Hi everybody,

    I'm working on a step by step game and i would like to know how can i know when an "animation" is finish.

    In my case, I apply a force to some balls, and i would like to detect when all balls have finish moving.

    (= when they are no more "animation" in canvas).

    Then i would like to make another event on this event "no more activity on canvas.

    Sorry for my poor english.

    And thanks you in advance.

    Kind regards !

    Thibaut.

  • Use the 'on animation finished' condition?

  • Thanks for you reply but i must missed somerhing.

    I thaght this condition was used for sprite animation, not for all canvas animation.

    Because on animation finished is prompting for an animation name ??? What should i put in this animation name for looking for canvas animation ?

  • So you mean you want to know when the image stops moving in the game, not when the images animation is completed?

  • I've only just got in to construct...

    If you tuck the objects position (self.X and self.Y) in to some new object instance variables (lastX and lastY), you could do a comparision (before you tuck them away) and see if the amount of change is small enough to warrant end of movement. Not sure how construct handles floating point numbers, but if the expression round(self.X-self.lastX)+round(self.Y-self.lastY) == 0 it has come to rest.

  • Yes, that's what I mean.

    I would like to know when there is nothing moving any more on the screen.

    Duckocide, your suggestion would probably solve my issue, good idea

    I will try that and tell you.

    But it means, i have to do that on every objects of my canvas... Or mayby create a family with all objects instead of having these variables an all my objects.

    I will tell you.

    Thanks you.

  • I try your solution but with no success.

    In fact, even if I put variables on my objects, I have to test the LastX en LastY of all the instance of my project.

    How could I do that ?

    If I test on : ObjectsMonster "myVariable" lasX lasst Y, it only test one of the instance (I don't know which one, probably the last one created).

    And I have to test on every instance.

    Any suggestion ?

    Thanks.

  • I all,

    I'm looking for a workaround, but I really don't find any solutions...

    Somebody must have encountered this case, no ?

    Just would like to test the activity on the canvas.

    Pleaseee, any help would be highhly appreciated :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thibaut - use the LastX and LastY instance variables as Duckocide said, but before you check them for all instances of the objects, set a global variable to 0, then when you check them, if they are different set the global variable to 1. Then all you have to do is have an event after this that checks the global variable, if it's still 0, then nothing is moving.

    I've made an example capx for you to look at. You can drag the balls around to get them moving.

    Check Moving Example CAPX(r108.2)

  • Hi, just to let you know your solution works perfectly

    That was just what i expected.

    Thank you very much !

  • You're welcome.

    Don't forget to share your game when it's done. I'd to see what it is you are creating.

  • Sure I will.

    But it will use webSocket and I'm just looking around that.

    But I will share when finished of course :)

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