How do I Fix My Enemy Problem

Get help using Construct 2

Post » Tue May 26, 2015 1:34 am

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.
B
6
S
1
Posts: 22
Reputation: 446

Post » Tue May 26, 2015 4:52 am

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.
B
32
S
9
G
4
Posts: 198
Reputation: 5,079

Post » Wed May 27, 2015 12:15 am

Sorry about that I forgot you could make a capx, here it is:

https://www.dropbox.com/s/2c83gqob1p8ql ... .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 :)
B
6
S
1
Posts: 22
Reputation: 446

Post » Wed May 27, 2015 1:47 am

Seems to work okay now. I left some notes in there for you on what I changed and why.
https://www.dropbox.com/s/1dtarmobgz06g ... .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!
B
32
S
9
G
4
Posts: 198
Reputation: 5,079

Post » Wed May 27, 2015 6:35 am

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 :D) 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)
B
6
S
1
Posts: 22
Reputation: 446

Post » Thu May 28, 2015 1:04 am

Happy to help. Good luck in the jam!
B
32
S
9
G
4
Posts: 198
Reputation: 5,079


Return to How do I....?

Who is online

Users browsing this forum: NN81, Syazanie Amirin and 7 guests