Use this basic method made be pyro for collsions, it's simple and works pretty well. Use velocities for movement instead of just moving the coordinates (ie. no x+=1; or x = x +1;)
Collision->top side->ground->with repeat yes
- Code: Select all
double mem = xvelocity;\\holds the current xvelocity
if(yvelocity >= 0)//if your falling
{
PhysicalResponse(MOVE_EVENT_ACTOR_ONLY, USE_CALCULATED_MASS, 1.000000,1.000000, 0.000000, 1.000000);
xvelocity = mem;//reset the xvelocity so you don't glitch up
jump=1;//reset jump variable
}
Collision->bottom side->ground->with repeat yes
- Code: Select all
double mem = xvelocity;
if(yvelocity < 0)//check if moving up
{
PhysicalResponse(MOVE_EVENT_ACTOR_ONLY, USE_CALCULATED_MASS, 1.000000,1.000000, 0.000000, 1.000000);
xvelocity = mem;
}
Collision->left or right side->ground->with repeat yes
- Code: Select all
double mem = yvelocity;
PhysicalResponse(MOVE_EVENT_ACTOR_ONLY, USE_CALCULATED_MASS, 1.000000,1.000000, 0.000000, 1.000000);
yvelocity = mem;
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.