Thread: Timer in 2D FPS

  1. #1
    Registered User
    Join Date
    Jun 2003
    Posts
    17

    Timer 2D FPS

    I am making a simple 2D FPS that displays a background structure that enemies will use for cover and randomly an enemy will lean around a corner (a bmp displayed of them leaning) and you have to shoot them. My question is how can I make a timer so if you dont shoot the enemy before the time runs out he will shoot you and as the game progresses the time before you are shot becomes shorter and shorter.

    Thanks for all of your input.
    Last edited by Jontay; 11-28-2003 at 05:26 PM.

  2. #2
    Registered User
    Join Date
    Nov 2001
    Posts
    202
    is this windows or Console?
    "Christ died for our sins. Dare we make his martyrdom meaningless by not committing them?"

  3. #3
    Registered User
    Join Date
    Jun 2003
    Posts
    17
    Win32. Using GDI.

  4. #4
    Registered User
    Join Date
    Nov 2001
    Posts
    202
    Then you can use the Timer function.
    SetTimer to start it, it sends WM_TIMER messages on it time it hits a certain amount of time(under one configuration and IMO the easy way to do it), then you use Killtimer to stop it from sending the messages. For more info look up SetTimer, WM_TIMER and KillTimer on MSDN.
    "Christ died for our sins. Dare we make his martyrdom meaningless by not committing them?"

  5. #5
    Registered User
    Join Date
    Jun 2003
    Posts
    17
    Thank you for your help.
    Last edited by Jontay; 11-28-2003 at 07:07 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. tic tac toe crashes :(
    By stien in forum Game Programming
    Replies: 4
    Last Post: 05-13-2007, 06:25 PM
  2. SwapBuffers & fps
    By hannibar in forum Windows Programming
    Replies: 0
    Last Post: 03-13-2006, 05:19 AM
  3. Game update...
    By jdinger in forum Game Programming
    Replies: 14
    Last Post: 11-08-2002, 07:10 AM
  4. SkyLock graphics demo (scrolling, etc.)
    By jdinger in forum Game Programming
    Replies: 9
    Last Post: 06-30-2002, 08:18 PM