Coins that don't respawn

Get help using Construct 2

Post » Sun Jun 02, 2013 9:52 pm

Hello!

I'm doing a platformer. In my game, the player has a set number of lives. Each time he dies, he gets back to the beginning of the level. The collectibles (COINS) should NOT respawn (so he cannot re-take a coin he already got).

But they should be back when he uses a continue. I'm not able to do that (the coins are set as Global, so they don't reapear between lives, but that way they don't reapear with a restart layout).

Any ideas on how to deal with that?
Thanks in advance!
B
6
Posts: 9
Reputation: 732

Post » Sun Jun 02, 2013 10:23 pm

You could use a global variable call it continues if continuing add to that number...

then add condition continues greater than 0 create coins...
As long as I can move left, right and fire, I'm Happy...
B
42
S
15
G
11
Posts: 655
Reputation: 12,260

Post » Sun Jun 02, 2013 10:29 pm

Just reading this again I am guessing you are not creating the coins at runtime...

if that's the case, and you don't have any performance worries then don't destroy them just set them invisible and deactivate collision detection then when continuing set them visible and reactivate collisions...

PS in most cases global objects are more hassle than they worth...Pixel perfick2013-06-02 22:35:53
As long as I can move left, right and fire, I'm Happy...
B
42
S
15
G
11
Posts: 655
Reputation: 12,260

Post » Sun Jun 02, 2013 11:14 pm

Thank you very much, Pixel perfick! I will use your suggestions as guideline. Another way would not to set the COINs as global, but then again I would have the problem of hiding then when already picked in that gameplay. Still learning a lot about Construct 2, thanks for your advice.
B
6
Posts: 9
Reputation: 732

Post » Mon Jun 03, 2013 12:47 am

Update: It worked wonders as you suggested! Instead of destroying the object (COIN), they were turned invisible and with deactivated collision. Then back on with the continue function.

Thanks again!
B
6
Posts: 9
Reputation: 732


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot] and 5 guests