Platz Function PlatzMove

From Uzebox Wiki
Jump to navigation Jump to search
Prototype

u8 PlatzMove(platzActor *a);

Description

Moves the actor through the level, taking collisions into account. Moving platforms must be updated within this function, so it should be called each frame regardless of the actor's status.

Parameters
  • a: The actor to move. Internal attributes define how the actor is to be moved.
Returns

Collision flag.

  • 0x01 = L_INTERSECT (intersection with the left-side of a background rectangle)
  • 0x02 = R_INTERSECT (intersection with the right-side of a background rectangle)
  • 0x04 = T_INTERSECT (intersection with the top-side of a background rectangle)
  • 0x08 = B_INTERSECT (intersection with the bottom-side of a background rectangle)
Video Modes

3

Since

V0.3a

Example:

char xVel, yVel; // Holds result of your custom player movement/physics code
platzActor a;
 
// ...
 
if (xVel != a.vx.vel)
    PlatzSetVelocity(&a.vx,xVel,&a.trLoc.x);
if (yVel != a.vy.vel)
    PlatzSetVelocity(&a.vy,yVel,&a.trLoc.y);
     
collFlag = PlatzMove(&a);
         
/*
 *  React to collFlag here (maybe animate or end jump sequence etc)
 */
         
MoveSprite(MY_SPRITE,a.sprx-a.bbx,a.loc.y-a.bby+1,MY_SPRITE_WID,MY_SPRITE_HGT);
PlatzTick();