And if I can add to that concept you can also base that speed on the amount of time elapsed since the last frame. That way if you are holding forward you move at the same speed regardless of whether you are getting 30, 60, or 100 frames per second.
So for example:
float distanceTravelledThisFrame = secondsElapsedSinceLastFrame * playerSpeedConstant;

Some very old dos games had speed problems when run on a faster computer because they were updating your position based on how many times the processing loop ran in a second rather than how much actual time had elapsed. You may remember games like Space Quest that had a speed setting so you could adjust this to be reasonable for your computer. But they didn't have enough settings to keep up with the rapid speed improvements of computers, smile.

Ian Reed


On 7/30/2013 4:12 PM, Ryan Strunk wrote:
Hi Cara,
I haven't pondered this. Are you saying, for example, that you could give
the player a forward velocity of 0.1, and as long as walking is true, update
that every time through the game loop? Then if the velocity is 0, he just
wouldn't move?
Fascinating concept. I wouldn't mind some clarification.
All the best,
Ryan

-----Original Message-----
From: Gamers [mailto:gamers-boun...@audyssey.org] On Behalf Of Cara Quinn
Sent: Tuesday, July 30, 2013 3:27 PM
To: Gamers Discussion list
Subject: Re: [Audyssey] looking for programming advice:
cyntaxdifferencebetween bgt and java

Hey there y'all,

Maybe I'm missing something here, but rather than using a timer at all,
would it not be more appropriate to simply calculate a velocity vector each
frame which could either stay static or change depending on the player's
surroundings. This way the player's movement could be calculated and
performed every frame. No timer necessary.

thanks for the great thread!

Smiles,

Cara :)


---
Gamers mailing list __ Gamers@audyssey.org
If you want to leave the list, send E-mail to gamers-unsubscr...@audyssey.org.
You can make changes or update your subscription via the web, at
http://audyssey.org/mailman/listinfo/gamers_audyssey.org.
All messages are archived and can be searched and read at
http://www.mail-archive.com/gamers@audyssey.org.
If you have any questions or concerns regarding the management of the list,
please send E-mail to gamers-ow...@audyssey.org.


---
Gamers mailing list __ Gamers@audyssey.org
If you want to leave the list, send E-mail to gamers-unsubscr...@audyssey.org.
You can make changes or update your subscription via the web, at
http://audyssey.org/mailman/listinfo/gamers_audyssey.org.
All messages are archived and can be searched and read at
http://www.mail-archive.com/gamers@audyssey.org.
If you have any questions or concerns regarding the management of the list,
please send E-mail to gamers-ow...@audyssey.org.

Reply via email to