Page 2 of 2

Re: nearly there but... stairs grrr

PostPosted: Fri Jun 24, 2011 7:03 pm
by foleyjo
I'm still not getting this.

I've tried different things but still can't get it to move like I need it

I have managed to make him walk left and right
jump up
jump diagnol
fall straight
and walk down stairs

but can't get him walking up the stairs.

The code I'm using now is
Collision Top Of Tiles (repeat while colliding) (also used on steps)
Code: Select all
char* key = GetKeyState();
if (yvelocity >= 0)
{  PhysicalResponse(MOVE_EVENT_ACTOR_ONLY, USE_CALCULATED_MASS, 1.000000, 1.000000, 0.000000, 1.000000);
  xspeed = (key[KEY_RIGHT] - key[KEY_LEFT]) * 8;
 // x += xspeed;
  JumpReady = TRUE;
}


Draw Actor
Code: Select all
char* key = GetKeyState();

if (yvelocity <13)
  yvelocity++;

if (JumpReady && key[KEY_SPACE])
{  yvelocity= -15;
 xspeed = (key[KEY_RIGHT]- key[KEY_LEFT]) *5;
 JumpReady = FALSE;
}
  x+= xspeed;


Collision Finish (Tiles)
Code: Select all
if (JumpReady)
  xspeed = 0;

JumpReady = FALSE;