Results 1 to 5 of 5

Thread: KeyDelay?

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2006
    Posts
    51

    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

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    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

  3. #3
    Lively Member
    Join Date
    Jul 2002
    Posts
    86

    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.

  4. #4
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    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

  5. #5

    Thread Starter
    Member
    Join Date
    Sep 2006
    Posts
    51

    Re: KeyDelay?

    vb6........

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width