One-time discoveries in replayable levels

0 favourites
  • 4 posts
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • 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. <img src="http://i.imgur.com/UiP0sqt.png" border="0" />

    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.

    Thanks!

  • Instance variables that are tracked in a global array objet?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

    <img src="http://i.imgur.com/3Bvex8Y.jpg" border="0" />

    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.

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