Quick question on shooting

Hi guys,

Im sure this is really easy, but I just cannot work it out :o.

Basically, im creating an air rifle that will shoot pellets. The pellets will be actual objects with dynamics and I have all that sorted and looks good. the rifle barrel opens and the pellets pop’s in and then you aim and shoot and with the dynamics enabled, the pellet gets a force of -7000 applied when you press the space bar (im just testing at this stage) and it flies out of the barrel (literally) and goes a distance before falling down (looks really accurate :eyebrowlift:).

Anyhow, one small question, I cannot get it so that you can only press the spacebar once, it’s set so you could keep pressing the space bar and force of -7000 would keep being applied - any ideas?

You can make a delay with python that will trigger with Space and switch a property value like Ready = False, then once the time is over the property is set back to True, firing require both Spacebar and Ready==True

Thats how I’d do it. :stuck_out_tongue:

Click “Tap” on the keyboard sensor, and have a property actuator change a boolean to false. Bullet fires with keyboard sensor and boolean = True.

Edit: You could also just have tap enabled, and use a state actuator to go to a blank state.