2 problems(glitchy muzzle flash, Automatically recentering camera)

  1. When ever I have the camera pointed in a certain direction, as soon as I start moving it re centers making me have to realign my aim.
  2. How can I make the muzzle flash plane only appear when the gun has ammo above 0. Right now whenever I click regardless of whether the gun has any ammo or not it still shows. How would I fix this.


The reason why your camera is resetting when you press w is because you have some logic bricks set up so when you press w it plays an ipo animation of the camera, resetting its orientation. And the muzzle flash is set to show when the mouse 1 button is down.

to fix (kinda) problem 1 just remove those bricks, to fix problem 2 you need to have the muzzle flash show when a bullet is shot, although i’m too lazy to look through the bricks to find out when that happens. If there isn’t one, you might need to make a slightly more complicated shooting system.

I made a simple (and pretty bad if you ask me) fps template which has a lot you can learn from it here.

K now I know about the camera.

Its easy, you first have to create a property that decrease the ammo count, for example, every time that you press the LMB your bullet count drop 1, then you create a property that when your bullets get on zero you go to another state and you cant shoot anymore, you do the same with the muzzle, and to reload and this stuff, if you dont understand what i said i can post you .blend.

K I fixed it thanks but how do I make the plane only stay for a small portion of time?

Your muzzle flash will be in another layer, then you use an edit object actuator, the type of the edit object actuator need to be add object, then on the OB space you put the name of the object that you want to add to the scene, and the time that it ll be on the scene.
I ll post a blend, stay put

The link for the .blend that i said, If you study it a little you ll understand what to do.
Link: http://www.mediafire.com/?omhcejwghjx

if your character starts to turn around like a fool, just open the script window, and look the mouselook side.py, Its weird i know, sometimes the mouselook just bugs and when i look to the code it works back again, but if you are making a game and you want to use some shaders to make it more realistic, this mouselook is 100x more efficient than the usual one, i dont remember who create it, but was perfect.

your welcome

Thanks for taking the time to look at the blend and help me.Also I tried making the muzzleflash spawn from another layer but it’s still not working. I tried looking at your template also

a muzzleflash would probably be faster if you parented it to the gun as invisible and set it to visible when you fire. Adding objects takes up to much resources. That should help, but I didnt look at ur blend so…dont quote me on it :slight_smile:

I did that but it stayed visible as long as the player held down lmb

turn the tap on on the sensor, this way if you press the rightmouse button for example it will no work