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

Just started using Construct 2? Post your questions here

Post » Sun Nov 23, 2014 7:45 pm

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
B
43
S
7
Posts: 79
Reputation: 4,295

Post » Mon Nov 24, 2014 12:55 am

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.
Last edited by GenkiGenga on Thu Nov 27, 2014 3:42 am, edited 1 time in total.
ImageImage
B
123
S
23
G
7
Posts: 1,071
Reputation: 13,091

Post » Wed Nov 26, 2014 4:29 pm

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
B
43
S
7
Posts: 79
Reputation: 4,295

Post » Thu Nov 27, 2014 3:37 am

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.
ImageImage
B
123
S
23
G
7
Posts: 1,071
Reputation: 13,091

Post » Fri Nov 28, 2014 9:06 pm

Wow! Genkigega. Tku very much, I am newbie yet in construct 2, I must study more.
Tku so much!
B
43
S
7
Posts: 79
Reputation: 4,295


Return to Beginner's Questions

Who is online

Users browsing this forum: Baidu [Spider], gyurto and 2 guests