Problems with instance variables

  • Hey guys, so building my first game, and ran into an issue that I can't seem to resolve. First, here is a link to the game so you'd know what I'm talking about:

    dl.dropbox.com/u/78940841/WingsOfDawn/index.html.

    The issue has to do with enemy lives. With the small enemy plane, I have no issues because 1 hit kills that enemy, and it's not in an instance variable. But I wanted the submarine to have 4 lives, so I made it have instance variable of 3. The problem with that, is that if there's more than 1 sub on the screen and one gets destroyed, the other gets destroyed too.

    My question is, should I add something else to make each sub unique so that they wouldn't all get destroyed when I'm shooting at one? Or do I need to do something different, meaning not use instance variables?

    -Eye

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You probably aren't picking correctly. Here's a quick test showing instance variables working, and destroying one sprite at a time.

    TestInstanceVariables

  • Okay thanks, I'll keep looking for mistakes I may have made..hmm I can't seem to open the file, was it made in Construct 1? Says it's build 99...

  • It's Construct 2, release 99. I did double check it downloads and runs.

  • r99 is the latest beta release, I'm guessing you have r95, the latest stable release. You can download it from the link "Download Construct 2" at the bottom of the front page under "Make games", or just click the one in my signature.

  • blackhornet + Nimtrix

    Sorry, my fault, I did have r95..installed the 99 release now, and file works. Will study it when I get home from work. Thanks for the help <img src="smileys/smiley1.gif" border="0" align="middle" />.

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