|
-
Apr 27th, 2007, 07:41 AM
#1
Thread Starter
Member
KeyDelay?
Im looking to make a key delay for my game, so that when the space bar is pressed it wont keep shooting my bullets but will have a half second delay. If you post code please comment it ! thx
-
Apr 27th, 2007, 10:47 AM
#2
Re: KeyDelay?
When you boot the computer, go into setup and set the repeat delay to 500ms.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Apr 28th, 2007, 06:36 PM
#3
Lively Member
Re: KeyDelay?
What you can do is have a global variable that has the time of when the space bar(or shoot button) is pressed. So when they press it, it checks if the time difference between now and the last time they pressed it is greater than half a second. If its greater than the half a second (or whatever value is reasonable) then shoot the bullet and set the variable to the current time.
Also make sure you only check the the shoot button is pressed when you are checking the difference in the times, or they wont be able to control the ship very well lol.
-
May 2nd, 2007, 06:46 AM
#4
Re: KeyDelay?
What code? What language are you using? We need some more information than just "show me code".
chem
Visual Studio 6, Visual Studio.NET 2005, MASM
-
May 2nd, 2007, 09:14 AM
#5
Thread Starter
Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|