Wii play tanks like game

Hi, i started to make a tank game like wii play tanks. (2.5x)

i have a problem with bullet counting. the tank can fire maximum five bullets. when A fired bullet explode, bullet value must be +1. but sometimes bullet value is being zero, no add +1.
how cn i fix it? with code?


tank.blend (452 KB)

Could you explain some more? How are you changing the bullet property?

See the attached file for a logic block solution (SPACE key to fire):


Finite_bullets.blend (332 KB)

rubbernuke: i already made this but bullet number must be five when bullets explode.

problem is: i have five bullet. when i fire one bullet, bullet count is four. and the fired bullet finishs. i have five bullet again.
i made this. But it is not working sometimes. Message system is problem i think. i have to make this with code

Your bullets are flying out of the arena. When objects are moving too fast they’ll go through objects without triggering the collision sensor. I have no idea why this happens, and would be very happy if someone would tell me.

I suggest you set up a system so that if the bullet is far enough away from your tank it will end itself.

I haven’t looked at the file, but if Infinite is right, then use a timer property to trigger the same things as the collision sensor. The reason that things will fly through walls when they are going to fast is because at one frame they are on one side of the wall, then at the next frame it has moved to the other side of the wall. The movement in the game engine is like teleportation, after each frame the object is moved to it’s next location without ever being in the locations inbetween.

i solved problem. now i need a bounce script. i made a picture


I’m pretty sure you can change the direction by reversing the signs on the motion. Like:

if collision.positive:
    lin = own.linearVelocity
    own.setLinearVelocity( -lin[0], -lin[1], 0.0)