All objects are being destroyed instead of one?

0 favourites
  • 4 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • Hello there,

    I've been checking out some capx samples and did some reading on tutorials and forums but have not been able to fully understand it yet and adapt it to my specific case.

    So hence I'm asking it here on the forum.

    When the aircraft shoots bullets and hits the T72 5 times the T72 is destroyed. But currently it destroys ALL the tanks that are spawned every x seconds. I have a global variable 'T72health'.

    This is the bit I have and think needs change?

    I know I have to pick instances but I just don't understand how to implement it.

    Thanks for any help.

    Regards R

    I can post more bits if necessary.

  • You should be using an instance variable for the tank health instead of a global variable. So to do this select the tank sprite and on the left in the properties click the blue text instance variables create one called health and start it off at 100. Then when a bullet hits it subtract 20 from that variable once the variable hits 0 spawn an explosion and destroy the tank. .CAPX attached.

    https://dl.dropboxusercontent.com/u/729 ... ample.capx

  • You can try pick by evaluation hp < or equal to 0 and yes use instance variable hp on the tank sprite.

    And then do destroy tank. The picking event picks the ones that has met and will continue to do so until the action is done.

    Take a step back from your work and write down the logic in a form of a question and then ask someone on that specific task. Construct two and other engine are very dumb they do no have our dynamic brain capability and require specific instruction. In other word just know that you are smarter then the engine you have to dumb down the code for the engine to know what you want.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks so much guys, it works perfectly now. And the solution was so easy.

    Regards

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