On Sat, Oct 29, 2011 at 11:49 AM, Alex Hall <mehg...@gmail.com> wrote:

> This looks very promising! A question though: you specify the speed as
> 1 meter per second, but the player is not always moving, and his
> movement is not specified by a timer. He cannot move any faster than a
> limit, but he can move as slowly as he wants. Does this throw anything
> off, or can I just use the player's stepLength float as speed and
>  disregard the "per second" component?

You need to think about what your game needs to do.  If you have a framerate
of 60, then you'll only need to move half as much each frame as you would if
your framerate is 30fps.

Now, there's no such thing as units in programming--that's something you
need to keep track of.  If x and y are defined in meters, and you're moving
the player once every second (maybe your framerate is 1fps), then the value
of "speed" will be "1.0".  If x and y are in meters, and you're moving the
player 47 times per second (maybe your framerate is 47fps), then the value
of "speed" will be "0.0213".  These values will produce the same apparent
speed to the user.

Basically, just think about it, and do what makes sense.  That's what
programming is all about.

Ian

Reply via email to