Destroying objects

0 favourites
  • 3 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • HEy i am making a mechanic for this game i am creating and i need to destroy a single instance of a object on screen and not all of them.

    capx

    In depth: When you hit space you create bubbles(Circles) and they rise up. What i want to do is destroy the bubble after t is created for a certain amount of time. If there are multiple of that said bubble on the screen i don't want all of them to be destroyed but only 1 at a time depending on how long they have been alive.

  • Create an instance variable "lifespawn" to your bubbles object.

    Either set it to 0 and increment it by 1 every frame/tick until it reaches 120 for example (120 = 2 seconds since the app runs at 60 fps).

    Or either set it to your max value, decrement it by 1 each frame and when it reaches 0 then you know you want to destroy that bubble.

    In one case or another, make a condition Bubbles.lifespawn = End_Value

    + action Bubbles.destroy (this will pick only the bubbles which lifespawn reached their final value).

    This is like the health mechanic in the Beginner's guide, page 6, private instances section

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks, i will ake a look at what you have said and linked. :)

    Ok got it working. I was thinking how instance variables work wrong. Now that i kno how they work it will be a lot easier.

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