I'm not sure why you wouldn't use a timer to calculate movement rate. If you
rely on whether the sound is playing or not, you run into a whole host of
problems:
* If you change the step sound, the game's speed changes.
* If your floor footstep is shorter than your grass one, you would move
faster on a floor.
* If you want to adjust speed either up or down on the fly, you're out of
luck.
* Literals, especially such obscure ones, are not a good idea.
If you're going to have your player move a tile at a time, use a timer, then
have the sound stopped and restarted if it's already playing.


-----Original Message-----
From: Gamers [mailto:gamers-boun...@audyssey.org] On Behalf Of Thomas Ward
Sent: Monday, July 29, 2013 7:49 AM
To: Gamers Discussion list
Subject: Re: [Audyssey] looking for programming advice:
cyntaxdifferencebetween bgt and java

Hi John,

Okay, I am glad you told me that, because what you want to do is going
to require some basic understanding of trig and geometry to pull off.
I can certainly help you with that, but there is absolutely no way out
of the math requirements for movement in that type of game.

First, simple integers for x and y coordinates won't work in an FPS.
They aren't precise enough for what you want and you'll loose accuracy
and precision. You would be better off using floats or even better yet
doubles for a wider degree of accuracy when moving from coordinate to
coordinate.

Second, you don't have to use timers to update the player's position.
You can simply update the player's position in real time as the up or
down arrow keys are pressed. To keep them at a constant speed you can
check if the step sounds are playing or not. If playing ignore the
command. If not playing play step sound and update position. That's
basically all there is to it.

Finally, as far as handling angles there are two ways of handling
this. You can use the Cartesian calculations with 0 oriented as due
east, or you can use the bearing system where 0 is oriented do north.
If we know how you want to handle this it will be pretty easy to pass
along some formulas for calculating your position.

Cheers!


---
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