Physics 2D Reference
Physics module optimized for 2D fighting games.
Position and Movement
These functions allow basic movement and positioning for entities.
Functions
Move | [1, 2] | [Init, Action, Manual] | |
---|
Moves the entity this frame, depending on facing.
- Arg 1: Horizontal move
- Arg 2: (Optional) Vertical move
|
MoveAbsolute | [1, 2] | [Init, Action, Manual] | |
---|
Moves the entity this frame, independant of facing.
- Arg 1: Horizontal move
- Arg 2: (Optional) Vertical move
|
SetPositionRelativeToTarget | [2] | [Init, Action, Manual] | |
---|
Sets the entity's position based on the target entity, dependant on its physics facing.
- Arg 1: Horizontal position
- Arg 2: Vertical position
|
SetPositionRelativeToTargetAbsolute | [2] | [Init, Action, Manual] | |
---|
Sets the entity's position based on the target entity, independant of its physics facing.
- Arg 1: Horizontal position
- Arg 2: Vertical position
|
SetTargetPosition | [2] | [Init, Action, Manual] | |
---|
Sets the target entity's position based on this entity, dependant of its physics facing.
- Arg 1: Horizontal position
- Arg 2: Vertical position
|
SetTargetPositionAbsolute | [2] | [Init, Action, Manual] | |
---|
Sets the target entity's position based on this entity, independant of its physics facing.
- Arg 1: Horizontal position
- Arg 2: Vertical position
|
SetWorldPosition | [2] | [Init, Action, Manual] | |
---|
Sets the position relative to the world origin, depending on facing.
- Arg 1: Horizontal position
- Arg 2: Vertical position
|
SetWorldPositionX | [1] | [Init, Action, Manual] | |
---|
Sets the position relative to the world origin, depending on facing.
- Arg 1: Horizontal position
|
SetWorldPositionY | [1] | [Init, Action, Manual] | |
---|
Sets the position relative to the world origin, depending on facing. |
SetWorldPositionAbsolute | [2] | [Init, Action, Manual] | |
---|
Sets the position relative to the world origin, independant of facing.
- Arg 1: Horizontal position
- Arg 2: Vertical position
|
SetWorldPositionAbsoluteX | [1] | [Init, Action, Manual] | |
---|
Sets the position relative to the world origin, independant of facing.
- Arg 1: Horizontal position
|
Variables
_PositionX | 0 | [] | |
---|
|
_PositionY | 0 | [] | |
---|
|
_MovementX | 0 | [ResetEachFrame] | |
---|
|
_MovementY | 0 | [ResetEachFrame] | |
---|
|
Momentum
Helper functions related to momentum, applies movement from frame to frame.
Functions
AddMomentum | [1, 2] | [Init, Action, Manual] | |
---|
Adds to the momentum, depending on facing. This will move the entity every frame.
- Arg 1: Horizontal momentum
- Arg 2: (Optional) Vertical momentum
|
AddMomentumAbsolute | [1, 2] | [Init, Action, Manual] | |
---|
Adds to the momentum, independant of facing. This will move the entity every frame.
- Arg 1: Horizontal momentum
- Arg 2: (Optional) Vertical momentum
|
SetMomentum | [2] | [Init, Action, Manual] | |
---|
Sets the momentum, depending on facing. This will move the entity every frame.
- Arg 1: Horizontal momentum
- Arg 2: Vertical momentum
|
SetMomentumAbsolute | [2] | [Init, Action, Manual] | |
---|
Sets the momentum, independant of facing. This will move the entity every frame.
- Arg 1: Horizontal momentum
- Arg 2: Vertical momentum
|
SetMomentumX | [1] | [Init, Action, Manual] | |
---|
Sets the momentum, depending on facing. This will move the entity every frame.
- Arg 1: Horizontal momentum
|
SetMomentumXAbsolute | [1] | [Init, Action, Manual] | |
---|
Sets the momentum, independant of facing. This will move the entity every frame.
- Arg 1: Horizontal momentum
|
SetMomentumY | [1] | [Init, Action, Manual] | |
---|
Sets the momentum, independant of facing. This will move the entity every frame. |
BreakMomentum | [1, 2] | [Init, Action, Manual] | |
---|
Reduces the momentum by the amount given.
- Arg 1: Horizontal momentum
- Arg 2: (Optional) Vertical momentum
|
BreakMomentumX | [1, 2, 3] | [Init, Action, Manual] | |
---|
Reduces the horizontal momentum by the amount given.
- Arg 1: Horizontal momentum break
- Arg 2: (Optional) Horizontal momentum cap
- Arg 3: (Optional) Horizontal momentum cap max
|
BreakMomentumY | [1, 2, 3] | [Init, Action, Manual] | |
---|
Reduces the vertical momentum by the amount given.
- Arg 1: Vertical momentum break
- Arg 2: (Optional) Vertical momentum cap
- Arg 3: (Optional) Vertical momentum cap max
|
BreakMomentumXAbsolute | [1, 2, 3] | [Init, Action, Manual] | |
---|
Reduces the horizontal momentum by the amount given, independant of facing.
- Arg 1: Horizontal momentum break
- Arg 2: (Optional) Horizontal momentum cap
- Arg 3: (Optional) Horizontal momentum cap max
|
CapMomentum | [2, 4] | [Init, Action, Manual] | |
---|
Limits the momentum to those values.
- Arg 1: Horizontal momentum
- Arg 2: (Optional) Horizontal Momentum Max
- Arg 3: Vertical momentum
- Arg 4: (Optional) Vertical Momentum Max
|
CapMomentumX | [2] | [Init, Action, Manual] | |
---|
Limits the momentum to those values.
- Arg 1: Horizontal momentum
- Arg 2: Horizontal Momentum Max
|
CapMomentumY | [2] | [Init, Action, Manual] | |
---|
Limits the momentum to those values.
- Arg 1: Vertical momentum
- Arg 2: Vertical Momentum Max
|
CapMomentumAbsolute | [2, 4] | [Init, Action, Manual] | |
---|
Limits the momentum to those values, independant of facing.
- Arg 1: Horizontal momentum
- Arg 2: (Optional) Horizontal Momentum Max
- Arg 3: Vertical momentum
- Arg 4: (Optional) Vertical Momentum Max
|
CapMomentumXAbsolute | [2] | [Init, Action, Manual] | |
---|
Limits the momentum to those values, independant of facing.
- Arg 1: Horizontal momentum
- Arg 2: Horizontal Momentum Max
|
AddMomentumTurn | [2] | [Init, Action, Manual] | |
---|
Adds to the momentum, depending on facing. If momentum is going in the opposite direction, cancel it before applying.
- Arg 1: Horizontal momentum
- Arg 2: Vertical momentum
|
AddMomentumTurnAbsolute | [2] | [Init, Action, Manual] | |
---|
Adds to the momentum, independant of facing. If momentum is going in the opposite direction, cancel it before applying.
- Arg 1: Horizontal momentum
- Arg 2: Vertical momentum
|
Variables
_MomentumX | 0 | [] | |
---|
|
_MomentumY | 0 | [] | |
---|
|
Flags
Facing
Functions relative to where the entity is facing, to handle forward / back / side directions.
Several types of facing are available for various purposes.
Functions
SetFacing | [1, 2] | [Init, Action, Manual] | |
---|
Set an entity's physics facing directly.
- Arg 1: Horizontal Facing
- Arg 2: (Optional) Vertical Facing
|
SetFacingWithType | [2, 3] | [Init, Action, Manual] | |
---|
Set an entity's facing directly, for any type.
- Arg 1: Type of facing to set
- Arg 2: Horizontal Facing
- Arg 3: (Optional) Vertical Facing
|
FlipFacing | [0, 1, 2] | [Init, Action, Manual] | |
---|
Flips the horizontal facing of an entity to make it face backwards.
- Arg 1: (Optional) Facing type (default: physics)
- Arg 2: (Optional) Also adjust vertical facing (default: false)
|
FaceTowardsTarget | [0, 1, 2] | [Init, Action, Manual] | |
---|
Faces the entity towards the target.
- Arg 1: (Optional) Facing type (default: physics)
- Arg 2: (Optional) Also adjust vertical facing (default: false)
|
TargetFaceTowardsSelf | [0, 1, 2] | [Init, Action, Manual] | |
---|
Faces the target entity towards this entity.
- Arg 1: (Optional) Facing type (default: physics)
- Arg 2: (Optional) Also adjust vertical facing (default: false)
|
CopyTargetFacing | [0, 1, 2] | [Init, Action, Manual] | |
---|
Copy the facing of the target entity to this entity.
- Arg 1: (Optional) Facing type (default: physics)
- Arg 2: (Optional) Also adjust vertical facing (default: true)
|
CopyFacingToTarget | [0, 1, 2] | [Init, Action, Manual] | |
---|
Copy this entity's facing to the target entity.
- Arg 1: (Optional) Facing type (default: physics)
- Arg 2: (Optional) Also adjust vertical facing (default: true)
|
CopyFacingToOtherFacing | [1, 2, 3] | [Init, Action, Manual] | |
---|
Copy one facing type to another facing type.
- Arg 1: Target facing type
- Arg 2: (Optional) Source facing type (default: physics)
- Arg 3: (Optional) Also adjust vertical facing (default: true)
|
Variables
FACING_PHYSICS | 0 | [] | |
---|
Facing type constant for the physics facing. This is used for movement. |
FACING_ATTACK | 1 | [] | |
---|
Facing type constant for the attack facing. This is not used for now. |
FACING_BLOCK | 2 | [] | |
---|
Facing type constant for the block facing. This is not used for now. |
FACING_MODEL | 3 | [] | |
---|
Facing type constant for the model facing. This is used for graphics. |
_FacingHPhysics | 1 | [] | |
---|
Horizontal physics facing. |
_FacingVPhysics | 0 | [] | |
---|
Vertical physics facing. Not used. |
_FacingHAttack | 1 | [] | |
---|
Horizontal attack facing. Not used. |
_FacingVAttack | 0 | [] | |
---|
Vertical attack facing. Not used. |
_FacingHBlock | 1 | [] | |
---|
Horizontal block facing. Not used. |
_FacingVBlock | 0 | [] | |
---|
Vertical block facing. Not used. |
_FacingHModel | 1 | [] | |
---|
Horizontal model facing. |
_FacingVModel | 0 | [] | |
---|
Vertical model facing. Not used. |
Collisions
Environment and Attack colliders setup.
Config
Functions
Colbox | [2, 3, 4] | [Init, Action, Manual] | |
---|
Sets the collision box, which will push other entities.
- Arg 1: Back bound (Optional)
- Arg 2: Front bound
- Arg 3: Down bound (Optional if only two parameters)
- Arg 4: Up bound
|
SetColboxMode | [0, 1] | [Init, Action, Manual] | |
---|
Sets the mode of the Colbox for collisions using one of the COLBOXMODE_ constants.
- Arg 1: (Optional) Colbox mode (default: Default)
|
SetColboxPhantom | [0, 1] | [Init, Action, Manual] | |
---|
Marks the Colbox as Phantom, meaning it will only collide with the environment.
- Arg 1: (Optional) If the colbox is phantom or not (default: true)
|
SetColboxLayer | [0, 1] | [Init, Action, Manual] | |
---|
Sets the layer of this colbox. By default, the layer is equal to the PID+1.
- Arg 1: (Optional) Layer to set (Default: PID+1)
|
Hurtbox | [2, 3, 4] | [Init, Action, Manual] | |
---|
Adds a hurtbox, that can be hit by hitboxes.
- Arg 1: Back bound (Optional)
- Arg 2: Front bound
- Arg 3: Down bound (Optional if only two parameters)
- Arg 4: Up bound
|
Hitbox | [2, 3, 4] | [Init, Action, Manual] | |
---|
Adds a hitbox, that can hit hurtboxes. You need to set attack data beforehand, though the Attack function. This function does not reset the attack data, so you can add several hitboxes for the same attack data by calling Hitbox several times.
- Arg 1: Back bound (Optional)
- Arg 2: Front bound
- Arg 3: Down bound (Optional if only two parameters)
- Arg 4: Up bound
|
ResetColbox | [0] | [Init, Action, Manual] | |
---|
Deletes the current colbox. |
ResetHurtboxes | [0] | [Init, Action, Manual] | |
---|
Deletes the current hurtboxes. |
ResetHitboxes | [0] | [Init, Action, Manual] | |
---|
Deletes the current hitboxes. |
Variables
_ColboxPhantom | 0 | [ResetEachFrame] | |
---|
|
_ColboxLayer | 0 | [ResetEachFrame] | |
---|
|
_ColboxMode | 0 | [ResetEachFrame] | |
---|
|
COLBOXMODE_DEFAULT | 0 | [] | |
---|
|
COLBOXMODE_OWNLAYER | 1 | [] | |
---|
|
COLBOXMODE_OTHERLAYERS | 2 | [] | |
---|
|
_Colbox | Null | [ResetEachFrame] | |
---|
|
_Hitboxes | [] | [ResetEachFrame] | |
---|
|
_Hurtboxes | [] | [ResetEachFrame] | |
---|
|
_PhysicsFlagBuffer | [] | [ResetEachFrame] | |
---|
|
Flags
PFAirborne | |
PFGrounded | |
PFWall | |
PFCeiling | |
PFLanding | |
Helpers
Functions
GetTargetPositionRelativeToSelf | [1, 2] | [Init, Action, Manual] | |
---|
Computes the position of the Target entity in this entity's physics referential, and stores it in the variables given.
- Arg 1: The variable in which to store the X position of the target
- Arg 2: (Optional) The variable in which to store the Y position of the target
|
Variables
_Gravity | 0 | [] | |
---|
|
_TerminalVelocity | -3000 | [] | |
---|
|
_FrictionGround | 0 | [] | |
---|
|
_FrictionAir | 0 | [] | |
---|
|
_CameraX | 0 | [] | |
---|
|
_CameraY | 0 | [] | |
---|
|
Flags
IgnoreGravity | |
IgnoreFriction | |
NoHurtbox | |
NoColbox | |
NoHurtboxSet | |
NoHitboxSet | |
NoColboxSet | |
Arena
Arena setup for fighting games.
Config
UseFightingArena | True | [] | |
---|
|
ArenaSize | 180000 | [] | |
---|
|
ArenaMaxPlayerDistance | 75000 | [] | |
---|
|
PhysicsNbBuckets | 4 | [] | |
---|
|