Increment after time

My game has lots of bugs at the moment :frowning:

The main problem I have right now is that I want the variable area,
initialized to 0 globally, to be incremented after five seconds.

Any idea how I would do this?

There is a function called SDL_GetTicks() which returns a number of
milliseconds that sdl has been running (I think that’s what it measures but
am not 100% sure).

You can call that function to get the number of milliseconds of when your
program starts up and then you can check in your game loop to see if
SDL_GetTicks() is 5000 greater than your first measurement (5000 miliseconds
= 5 seconds), if it is then you can increment your variable or whatever you
want to do after 5 seconds._____

From: sdl-bounces+atrix2=cox.net@libsdl.org
[mailto:sdl-bounces+atrix2=cox.net at libsdl.org] On Behalf Of Sahan
Chandrasekara
Sent: Friday, September 22, 2006 9:32 PM
To: A list for developers using the SDL library. (includes SDL-announce)
Subject: [SDL] Increment after time

My game has lots of bugs at the moment :frowning:

The main problem I have right now is that I want the variable area,
initialized to 0 globally, to be incremented after five seconds.

Any idea how I would do this?

It dosen’t work :frowning:

Timers never work in my game - the regulating frame rate from Lazy Foo’s
website didn’t work eitherOn 9/23/06, Alan Wolfe wrote:

There is a function called SDL_GetTicks() which returns a number of
milliseconds that sdl has been running (I think that’s what it measures but
am not 100% sure).

You can call that function to get the number of milliseconds of when your
program starts up and then you can check in your game loop to see if
SDL_GetTicks() is 5000 greater than your first measurement (5000 miliseconds
= 5 seconds), if it is then you can increment your variable or whatever you
want to do after 5 seconds.


From: sdl-bounces+atrix2=cox.net at libsdl.org [mailto:
sdl-bounces+atrix2=cox.net at libsdl.org] *On Behalf Of *Sahan Chandrasekara
Sent: Friday, September 22, 2006 9:32 PM
To: A list for developers using the SDL library. (includes SDL-announce)
Subject: [SDL] Increment after time

My game has lots of bugs at the moment :frowning:

The main problem I have right now is that I want the variable area,
initialized to 0 globally, to be incremented after five seconds.

Any idea how I would do this?


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Sahan Chandrasekara

Get a free sony psp at http://psps.freepay.com/?r=30890215 (not a scam)

I garauntee you it works when implemented properly.

Here’s what I recommend. (:

Go to gameprogrammer.com and subscribe to the mailing list and post your
question there.

That list is more for game programming techniques where this one is just
about sdl, problems using it, etc.

Lots of people here are members of that list (myself included!) so go on
over and let’s discuss this more (:_____

From: sdl-bounces+atrix2=cox.net@libsdl.org
[mailto:sdl-bounces+atrix2=cox.net at libsdl.org] On Behalf Of Sahan
Chandrasekara
Sent: Friday, September 22, 2006 9:43 PM
To: A list for developers using the SDL library. (includes SDL-announce)
Subject: Re: [SDL] Increment after time

It dosen’t work :frowning:

Timers never work in my game - the regulating frame rate from Lazy Foo’s
website didn’t work either

On 9/23/06, Alan Wolfe < Atrix2 at cox.net> wrote:

There is a function called SDL_GetTicks() which returns a number of
milliseconds that sdl has been running (I think that’s what it measures but
am not 100% sure).

You can call that function to get the number of milliseconds of when your
program starts up and then you can check in your game loop to see if
SDL_GetTicks() is 5000 greater than your first measurement (5000 miliseconds
= 5 seconds), if it is then you can increment your variable or whatever you
want to do after 5 seconds.


From: sdl-bounces+atrix2= cox.net@libsdl.org
[mailto:sdl-bounces+atrix2=cox.net at libsdl.org] On Behalf Of Sahan
Chandrasekara
Sent: Friday, September 22, 2006 9:32 PM
To: A list for developers using the SDL library. (includes SDL-announce)
Subject: [SDL] Increment after time

My game has lots of bugs at the moment :frowning:

The main problem I have right now is that I want the variable area,
initialized to 0 globally, to be incremented after five seconds.

Any idea how I would do this?


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Sahan Chandrasekara

Get a free sony psp at http://psps.freepay.com/?r=30890215 (not a scam)