Ok, now I just need to know the "if(space_was_released)" command, could anyone please help I just need this command to make it work
( this is how I'll do it )
if (keys[VK_SPACE])
{
if (max != 1)
{
p1y += 0.2f;
}
}
if (keys[VK_WAS_RELEASED?])
{
max = 1;
}
Jumping?
nvm i found it!! thanks all for help ^^
if(!keys[VK_ESCAPE])
{
max = 1;
}
:D:D:D:D::D:D:D:D:D:D::D:D
if(!keys[VK_ESCAPE])
{
max = 1;
}
:D:D:D:D::D:D:D:D:D:D::D:D
Windows sends both WM_KEYDOWN and WM_KEYUP commands... I suggest you use that. Escape isn't really meant to quit jumping...
for real man you need to read a book man. it seem to me that you have no idea what you supposed to do. But i will be generous and give you a function that will do it for you here it is.
void PlayerJump(float delta)
{
/*We will assume we have a variable called
Gravity,Player_Y,Velocity,FallingLimit*/
Gravity=-9.81f //Gravity is Contant
Velocity+=Gravity*delta;
Player_Y+=Velocity;
if(Player_Y>FallingLimit)Player_Y=FallingLimit-1;
}
//Hope that gives and Idea on How you need to Implemented
if you do not know how to declare those Variable then you are not supposed to be writting games. By the way GLFloat is the same as float
void PlayerJump(float delta)
{
/*We will assume we have a variable called
Gravity,Player_Y,Velocity,FallingLimit*/
Gravity=-9.81f //Gravity is Contant
Velocity+=Gravity*delta;
Player_Y+=Velocity;
if(Player_Y>FallingLimit)Player_Y=FallingLimit-1;
}
//Hope that gives and Idea on How you need to Implemented
if you do not know how to declare those Variable then you are not supposed to be writting games. By the way GLFloat is the same as float
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement