bullet direction and object interactions

hi everyone,

i’ve made some more progress on my game; i now have a character who can walk forwards, backwards, run, jump and shoot.

well… he can shoot, but it’s pretty hard to aim the bullets.

so, first thing: i have posted some videos here:

just scroll down a bit to the flash player and skip to the later videos to see where i’m at.

anyways, i have a gun object that (using logic bricks) will add a bullet object with a velocity in a ‘local’ direction (relative to the gun object, i hope) whenever the ctrl key is pressed.

two things:
first, how can i predict what’s ‘local’ to the gun object? as in… if i set the bullet up to move along the y-axis (local) then how can i tell from the object center which way is which?

second, the bullet obviously is added as soon as the ctrl key is pressed, but i would like to delay it a bit so the character can get into his ‘shoot’ pose and then shoot. any instructions on setting up a delay? or tutorials out there? :o

thanks a lot

the solution, if anyone is interested, is to use an empty as the object that adds the bullet, rather than the gun itself.

add an empty, line it up as desired (so the axes line up with the gun, for example) and then parent the empty to the gun (empty is child of gun).

then apply logic bricks to the empty.

thank again to josip kladaric for the help.

still no luck with the delay though, open to suggestions.


switch to another state, use a delay sensor to “fire” then switch the state back to the original