Why the "persist" behavior dont work in this capx?

0 favourites
  • 5 posts
From the Asset Store
Rotate & Animation for 16 Direction & Mouse Direction
  • I wanted to do this cooldown persist in the next layout.

    Someone could tell me what the problem in this code that prevents it work right.

    https://www.dropbox.com/s/d61s5d1m8mu28 ... .capx?dl=0

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Its not a problem in your code, its just the way persist behaviour works.

    For each of your layouts the ball is persisting but your logic is to spawn a filler every 1 second on the active layout. When you switch layout its not bringing those filler objects as well because you aren't directing it to.

    If instead you gave your ball a filler variable instead and then compared that variable to decide how much of the object was covered it would work that way. That's why the angle is persisting in the example.

    Creating an object and just giving it persist will mean that the object will persist on THAT layout only.

  • Man, I am newbie and I did not understand what you said, hehehehe, but I tried, really, and I could not solve.

    In fact, this cooldown is a post of this forum. The cooldown issues was solved, but it persists I can not imagine how this should be done.

    If anyone can help I would be very grateful.

    Ah! Sorry for the bad english too.

    Tks

  • Haha, sorry dznerpro.

    Let me try again. If you create an object on Layout 1 and give it persist behaviour. It will exist on Layout 1 but not Layout 2 (unless you create it when you switch to another layout).

    The angle works because it is based off a global variable.

    Here is a different approach. Instead of spawning many filler objects lets just rotate half of the circle and cover it up when we need to.

    https://db.tt/mUjwjjkG

    To show you how to do it, I just quickly adjusted the circle sprite in c2 and so it looks a bit funny. To make it smoother, you need to fix the graphics yourself (make sure the halves are actually half of the circle etc).

    All of the persist behaviour is gone.

  • Wow! Genkigega. Tku very much, I am newbie yet in construct 2, I must study more.

    Tku so much!

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