How do I remove coins when layout restart?

0 favourites
  • 5 posts
  • Hello guys,

    I'm new to C2 and I try to design a platform game but I encouter a problem with my scoring experience.

    Basically, the player collects coins through the level and get a score. My problem arises when I restart the layout before the end of the level (for example, the player falls down or touches an enemy therefore the player is killed) so I need to restart the layout to try again). But, when I restart the layout, the coin already collected in the level will automatically reappear despite the fact I create an destroy event for the coin.

    So in the event sheet I have:

    Condition: Player on collision with coin, Action: Coin destroy, Action add 1 to Score (glob var) and Coin set invisible.

    Thanks for your help!

  • Notorious406

    Problem is, when you restart your layout everything on it is destroyed and then whole layout is recreated.

    One way to solve this is to put UID of each coin player picks in an array, and then when you restart the layout pick each coin by UID number in array and destroy it.

    Another way would be to avoid layout restart if you can.

  • Open a new project in C2 and search for persist.... template.

    It use a behavior I believe. Much more simpler and no need to use special tricks

  • razorMonkey I avoid restart the layout and now it works perfectly (just played with player (set position , set disabled, wait x sec, set enabled)).

    Thank you!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Or you use the Persistent-Behavior as ikke2902 said. That works also perfect and you don't have to set/change any variables.

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