Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

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.


Messages - Pirate

Pages: [1]
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.

2
General / [Solved] Player moves faster to the left :*(
« on: January 19, 2011, 01:46:25 am »
Well I figured it out.


I was storing mVelocity.x and .y as integers :*( switched it to float and everything is all good now.

3
General / [Solved] Player moves faster to the left :*(
« on: January 19, 2011, 01:22:35 am »
changing mMovement from = 1; to = 2;  seemed to fix it.
I have no idea why.

But now left (-1) and right (2) have the same speeds :*(

I made this change after stripping everything down, and It still wouldn't go right.

and if I make changes to "2000" in the velocity formula it breaks right movement again.

4
General / [Solved] Player moves faster to the left :*(
« on: January 19, 2011, 01:07:06 am »
I must of really messed something up somewhere then.
What you are saying makes perfect sense.

just for some reason It won't move right :{

5
General / [Solved] Player moves faster to the left :*(
« on: January 19, 2011, 12:56:05 am »
if I remove the + I lose the ability to go right.

hrmm, but then left seems to be the proper speed :{

6
General / [Solved] Player moves faster to the left :*(
« on: January 19, 2011, 12:45:03 am »
I'm running into some problems with my fixed time step and calculating negative movement.

When the player pushes the left key mMovement = -1; right key mMovement = 1;

my problem is that when moving left "-1" the player goes faster then if they were going right "1";


main loop
Code: [Select]

float deltaTime = App.GetFrameTime();

mainPlayer.Update(deltaTime);
otherPlayer.Update(deltaTime);



player update
Code: [Select]

// 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);



0_o I'm sure it's something very simple, but I just can't seem to figure it out.

when I breakpoint it,  the velocity seems to be clamped at the proper positive or negative number so it's something with

Code: [Select]

mPosition.x += mVelocity.x * ElapsedTime;

Pages: [1]