One-time discoveries in replayable levels

Get help using Construct 2

Post » Tue May 14, 2013 12:08 am

Okay so in my game, there's caged frogs that you need to rescue. The first time you rescue each one, an animation plays and the global # of frogs you've rescued goes up by 1.

When re-visiting that layout, the frogs you haven't rescued yet should remain caged, but the ones you have should default to their rescued animation and no longer be free-able.

So far, I have it working for my one test frog, but I'm afraid my code could get out of hand if I were to put the rest of them in the game.

Froo1 is my placeholder name for whether or not frog #1 has been freed. My attempts to put them all in a family have been unsuccessful so far. (When one gets rescued, the animation triggers on every frog in the level)

Please advise. And I hope the answer isn't just "bite the bullet and make a global for each one" because I'm also planning on a 2nd one-time discovery in replayable levels and I don't want my globals list to be 500 miles long.

Posts: 13
Reputation: 478

Post » Tue May 14, 2013 12:47 am

Instance variables that are tracked in a global array objet?
Posts: 1,833
Reputation: 14,393

Post » Tue May 14, 2013 12:49 am

I believe an array would be your answer. Store the values of FrooX:

Froo Set At X

and then compare Froo.At(X)

Or something like that...

I am new at this, too :)

EDIT--Oh yes, use an instance variable for each one, too as BluePhaze suggests. Or perhaps have the 2nd dimension of the array hold each frog's UID. Then you can test for which Frog is being picked up by comparing UID in the collision event.tensegrity2013-05-14 00:53:18
Posts: 5
Reputation: 305

Post » Sat May 25, 2013 3:45 am

Thank you for getting back to me and steering me in the right direction. I've never used arrays before so I'm still having some trouble getting it to work right.

That's my best crack at it so far. It works fine for the first frog I zap, but I get no response when trying to zap a 2nd.
Posts: 13
Reputation: 478

Return to How do I....?

Who is online

Users browsing this forum: al64inthedark, Bro7hers, Eren, Fedemcuru, hej2010, R0J0hound, SacrilAI and 14 guests