Platz Function PlatzSetVelocity

From Uzebox Wiki
Jump to: navigation, search
Prototype

void PlatzSetVelocity(velocity *v, char val, u8 *trPos);

Description

Sets the velocity of v to val and adjusts the trigger position in the case of a direction change. This last step ensures triggers fire when they are supposed to and do not re-fire despite the interaction between bounding box size changes and direction swapping.

Parameters
  • v: The velocity struct we wish to alter.
  • val: The base velocity to set v to (see velocity type documentation for further details).
  • trPos: The trigger position that is axially related to this velocity struct.
Returns

Void

Video Modes

3

Since

V0.3a

Example 1: Increment the player's horizontal velocity.

platzActor a;
 
PlatzSetVelocity(&a.vx, a.vx+1, &a.trLoc.x);

Example 2: Decrement the player's vertical velocity.

platzActor a;
 
PlatzSetVelocity(&a.vy, a.vy-1, &a.trLoc.y);