1
General / [Solved] Player moves faster to the left :*(
« on: January 19, 2011, 02:19:09 am »
yes since the ElapsedTime was a fraction It was messing up the formula.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
float deltaTime = App.GetFrameTime();
mainPlayer.Update(deltaTime);
otherPlayer.Update(deltaTime);
// Player pushes Left then mMovement is "-1" right mMovement is "1"
mVelocity.x += mMovement * 2000 * ElapsedTime;
mVelocity.x = clamp(mVelocity.x, -100, 100);
// Apply velocity.
mPosition.x += mVelocity.x * ElapsedTime;
mSprite.SetPosition((int)mPosition.x, 600);
mPosition.x += mVelocity.x * ElapsedTime;