2d physics game doing it right

I have a suspicious suspicion that I am doing this wrong. It works now, to the extent that gravity pulls an object down to the ground, but I am having problems controlling the speed of the object.

What is it, the ball jumps and falls to the ground.

I have another function called "jump" that adds jSpeedyVel to it

I can increase gravityand it falls faster.

I can increase the speed jSpeed, and it will increase longer, but not faster

But I can’t get him to do everything faster. It looks very slow, which may or may not be due to the fact that my emulator is running at 11 frames per second.

Is it just my emulator, or is it something at my end?

float time = elapsedTime/1000F;
if (speed < maxSpeed){
    speed = speed + accel;
}
if(mY + mVelY < Panel.mHeight){ //0,0 is top-left
    mVelY += (speed);
}

if (!(mY + height >= Panel.mHeight)){
    mVelY = mVelY  + gravity ;
}

mX  =  (float) (mX +(mVelX * time));
mY =  (float) (mY + (mVelY * time));
+3
1

, , .

- , . - () .

, "", . , "", YVel jspeed - , :

if(mY + mVelY < Panel.mHeight){ //0,0 is top-left
  mVelY += (speed);
}

, - , , , , .

, maxspeed XVel, YVel, - .

0

All Articles