Different Weapons & Bullets Hitting one enemy.

Discuss game development design and post your game ideas

Post » Thu Sep 07, 2017 4:50 pm

Hello Every One :) How things Going on?
I am making a top down stealth and shooter game. in this I have experienced a problem and trying so much but could not solve it. the problem is when I shoot an enemy with one weapon and when the bullets runs out I switched to another weapon with different bullet but the enemy is not destroyed.I gave only one instance variable to the enemy called Health=20 and when the player shoots the enemy with the pistol the health has to reduce to 3 and when the player shoots with the machine gun the health drops by 5. so there is a clash in the number I gave in the instance.If the enemy is left over with the health number that could not match with the second weapon life taking number its not working.
..........................................................................PLEASE DO HELP ME FIX THIS................ :)
B
7
S
1
Posts: 23
Reputation: 483

Post » Thu Sep 14, 2017 10:38 am

Not sure I understand. It sounds like you are making the enemy die when health = 0, rather than testing if health <=0. If you test whether the health is at zero or lower then it works. Otherwise damage has to make the enemy go perfectly to zero health.
B
52
S
15
G
4
Posts: 191
Reputation: 5,612

Post » Tue Sep 26, 2017 9:16 am

Thank You for the reply. and Its working when I changed it to <0. :)
B
7
S
1
Posts: 23
Reputation: 483


Return to Game Development, Design & Ideas

Who is online

Users browsing this forum: No registered users and 0 guests