How do I Fix My Enemy Problem

0 favourites
  • 6 posts
From the Asset Store
Give Sound to the enemies that are part of your game! :)
  • Hiyas,

    I don't really know how to word it and because of that, failed at searching for a fix. In my game I have multiples of the same enemy and they have a instance variable for their HP, so as far as I know they should have independent HP. Now it all works fine and dandy if you take them on one at a time, but every time I shoot and kill more than one enemy in quick succession the second enemy becomes invincible. I have just a basic set up of when bullet hits enemy, subtract 1hp, at 0 hp enemy is destroyed. It should be impossible for both enemies to hit 0 at the same time so I don't understand why it doesn't work.

    If anyone could help me with this I'd be so thankful.

  • Without seeing a screenshot of the events or the capx itself it's hard to say. Off the top of my head, do your attacks do more than 1 point of damage at a time? It's possible you're overshooting 0. If that's the case, try setting it to check for less or equal to 0 rather than just equal to. I know that tripped me up a few times.

  • Sorry about that I forgot you could make a capx, here it is: ... .capx?dl=0

    I checked the less or equal thing and it's all good, the bullet only does 1 damage and the plants only have 2 HP so I still don't understand why.

    If you want to test it yourself you gotta kill the 2 plants pretty fast, if you miss you can just push r and it'll reset layout (you might want to turn volume down though as the music can get annoying at this stage). There's tutorial text at the top but in case you just want to do it quickly its:

    Z to roll and brake barrels

    X+UP/DOWN to aim

    C while aiming to shoot (shoot the big box on the top half to knock it over so you can jump on it to get to the plants)

    A while standing to reload

    S while standing to use medpack

    D when the ding sound effect and ! prompt appears for tutorial text

    I'm making this for the Construct Game Jam, my first game too, but yeah let me know if you find anything I messed up. Thanks <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

  • Seems to work okay now. I left some notes in there for you on what I changed and why. ... .capx?dl=1

    Oh man, I just remembered! I moved the player starting position and set the preview browser to NW.js to simplify testing and forgot to change them back. Sorry!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No problem at all I just set them back, but thanks so much! It works perfect now and I even copied what you did to the barrels and theyre working much better too. (Edit: Just figured out what you did with the music, it will help a lot in the future ) The only problem is the physics doesn't seem to work anymore on the barrels/box when they're shot at. Could it be because I just updated to the lastest C2? I was on 195 before but yeah, I'll try to find out why (Double edit: I added apply impulse to the box at bullet angle and it works again! I don't understand why it worked before without it but oh well)

  • Happy to help. Good luck in the jam!

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