Please Help.

if(yvelocity>0){
PhysicalResponse(MOVE_EVENT_ACTOR_ONLY, USE_CALCULATED_MASS, 1.000000, 1.000000, 000000, 1.000000);
canjump=1;
}
char *key=GetKeyState();
if(key[KEY_LEFT]==1){
xvelocity=-5;}
else if(key[KEY_RIGHT]==1){
xvelocity=5;}
if(key[KEY_RSHIFT]==1){
if(canjump==1){
yvelocity=-22;
canjump=0;
}
}
yvelocity++;
double yv = yvelocity;
if (yv > -1) // if we're not moving down, we shouldn't collide.
{
double ychange;
PhysicalResponse(MOVE_EVENT_ACTOR_ONLY, USE_SPECIFIED_MASS, 1, 1, 1, 1); //apply the physics
ychange = abs(yprevious - y); //how much has our y position changed?
if (ychange > yv) // if we've moved further than our initial yvelocity, we shouldn't have collided
{
yvelocity = yv; //reset our yvelocity
y = yprevious + yvelocity; //reset our y position
}
else //otherwise, the collision was correct
{
oG = 1; //we adjust our onGround variable, and do any other actions we would do on the collision
}
}
if(yvelocity>0)
{
if (oG ==1)
{
PhysicalResponse(MOVE_EVENT_ACTOR_ONLY, USE_CALCULATED_MASS, 1.000000, 1.000000, 000000, 1.000000);
canjump=1;
}
}
Users browsing this forum: No registered users and 1 guest