GLProgramming.com

home :: about :: development guides :: irc :: forums :: search :: paste :: links :: contribute :: code dump

-> Click here to learn how to get live help <-


New Paste :: Recent Pastes:: No Line Numbers


Jump by Sacha
1
 
#define ACCELERATION 980.0f
#define GRAVITY -9.8f

void Jump(int nOption) {
    if ((cVeloY = -ACCELERATION) && (nOption)) {
        cVeloY = ACCELERATION;
    }
    if ((cVeloY != -ACCELERATION) && (!nOption)) {
        myPosition.y += cVeloY;
        cVeloY += GRAVITY;
    }
}


...  } else {
         LockSpeed();
         Jump(0);
         RenderGame();
     }...

...if (GetKeyState(VK_SPACE) & 0x80) Jump(1);...


I just did this in a minute - any ideas why it doesn't work?