• Create Account

# Pasanova

Member Since 16 Sep 2012
Offline Last Active Sep 27 2012 10:26 AM

### Moving a constant number of pixels per second

24 September 2012 - 11:45 AM

Hello Everyone,
• I update the position of my objects every time I go through my game loop
• I have a function that calculates the number of loops per second, lets say there are 100
• I want to move my object at a constant rate of 30 pixels per second (which is already quite fast)
• This means that I should move my object 0.3 pixels per loop
• This is a problem!
How do you normally get around this? Thanks!

### Quick SDL_ttf question

23 September 2012 - 03:18 AM

I have exactly the same problem as
which he has solved, but I just don't know what he means by src folder?
At first I thought he might mean the folder where all the source files
are but that didn't work...so close to the answer but oh so far!

### Constant acceleration: Point out why I am an idiot

16 September 2012 - 04:57 AM

Sorry to reference such an old thread but http://www.gamedev.n...ering-behavior/
refers precisely to the thing I am having trouble understanding!

In

//calculate the speed required to reach the target given the desired
//deceleration
double speed = dist / ((double)deceleration * DecelerationTweaker);

How does this calculate the speed? I just cannot understand it, besides doesn't
x/a have the dimensions of time squared?
I think it should be completely different, I am obviously missing something
u-Initial (current) velocity required (what we want to calculate above)
v - Final velocity (in this case zero)
x - Distance to target "dist" in the above?
a - The acceleration, in the above a = -deceleration * DecelerationTweaker?
Constant acceleration equation:
v^2 = u^2 + 2ax
therefore
u = sqrt(2*deceleration * DecelerationTweaker*x)
Can anybody point out the error?

PARTNERS