well my question is how do I get a sprite to jump.
void spritejump()
{
if (state == false)
{
jump++;
if (jump >= 20.0f)
{
state = true;
}
}
else if (state == true)
{
jump--;
if (jump <= 0.0f)
{
state = false;
}
}
// cout << "jump: " << jump << endl;
}
void handleKeypress(unsigned char key, int x, int y)
{
int animate = 0;
switch (key)
{
case 27:
exit(0);
break;
case 32:
animate = !animate;
if (animate)
{
glutIdleFunc(spritejump);
}
else
{
glutIdleFunc(NULL);
}
break;