TNT Basic Forums > Programming Q&A
Bullet System,Help! (again)
< Last Thread     Next Thread >
Thread        Post A Reply

01-07-2002 20:20

Posted by:
Tony Rose

Click Here to Email Tony Rose   Find more posts by Tony Rose

You might remember me posting awhile back with questions for a bullet system in the game I am working on. Well,Ive made 3 systems from scratch and scrapped them all,they just werent what I was looking for. Im making a new one (sigh) and need some help....

How would I make a system where If the player presses the fire button(space bar) the game would fire one projectile and not fire again until the spacebar is pressed again. So that you cant just hold the spacebar to fire more. If you want a good example of what Im talking about download Freeverse's game Wingnuts,its small and im sure youll have fun playing it anyway :)

Thx very much in advance!

01-07-2002 21:43

Posted by:
Mark Tully

Find more posts by Mark Tully

Sample Code For Semi-Automatic Firing

A simple way to accomplish this goes something like:

int pressedLastTimeAround=false


...... do some game stuff......

' test fire
if poll input (0) ' player holding fire button
if not pressedLastTimeAround
end if
' button not pressed
end if

..... do some other game stuff.....


procedure FireMyMissile()
end proc

As you can see, you simply look if they were holding the button in the last frame, if they were don't fire a new missile, if they were not then they've just hit it so fire a missile.

Good luck!


01-09-2002 17:15

Posted by:
Tony Rose

Click Here to Email Tony Rose   Find more posts by Tony Rose

Thx so much!

I got a system that I actualy like now! It only took me 4 tries and several weeks of headache! Thanks alot,I really like how the TNT staff respond so fast to questions!

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.