Tank Game Help Please

Hello, I’ve been working on a tank game recently, and I’ve been struggling to make both the player tank and enemy tank blow-up/die.
I did not use python so far. Can anyone help me make these tanks get destroyed?

1 Like

hello Aj8841,
you can do like that:
object “projectile”=> add a property named “bullet”, set to integer
that integer value can be used as future bullet damage, or bullet penetration power…

object tank.001=> property “hp” set to more than 0 (is 0 in your .blend)
add sensor collision=> set property to “bullet”
linked to an actuator property=> set to “add”, property “hp”, add -1

add sensor property=> set to “hp” equal 0
linked to actuator edit object=> set to “end object”
you can add another actuator before, set to “replace mesh” if you want to show a destroyed tank, you need to design a destroyed tank

1 Like

Thanks so much, I’m just getting to know BGE

So now, I need help on making the enemy tank re spawn,
I also added an explosion, but it is kinda bad. If i can get any way to make the explosion better, please inform me.

like you created “projectile”, you can use another empty
this empty will be the “spawner” in combination with a keyboard sensor or others events ( a delay sensor for exemple )
empty “spawner”=> sensor keyboard=> actuator edit object ,“add”, “tank.001”

1 Like

Ok, I got the spawner, and added a first person view. But now, I really need help on the explosion of the enemy tank. Right now it is pretty bad.

for explosion,
common way is to use 3 (or more) planes, with explosion picture on it and oriented in x, y ,z
you merge them in one object
you scale this object to make it like explosion when hit and then end it
use python “object.scaling” in an attached script

same as for gun muzzle flash

1 Like

Ok thx, I’ve been working on more sound fx and I realized I need the gun to shoot once and wait until a button is pressed to reload it.
Any suggestions?

Actually, I figured it out, thanks for the help though!

1 Like