Skip to content

Collision Behaviors

Lojemiru edited this page Sep 13, 2021 · 2 revisions

The following collection of functions are built-in collision behaviors intended for plug-and-play use. They can be assigned as the sole function for a collision, or can be called within another collision function. Calling them outside of a collision event will result in undefined behavior.


lhc_behavior_push

Pushes the colliding instance to the appropriate bounding box edge.

Syntax:

lhc_behavior_push();

Returns: N/A

Example:

lhc_add("IPushable", lhc_behavior_push);

lhc_behavior_push_horizontal

Pushes the colliding instance to the appropriate bounding box edge on the horizontal axis.

Syntax:

lhc_behavior_push_horizontal();

Returns: N/A

Example:

lhc_add("IPushableH", lhc_behavior_push_horizontal);

lhc_behavior_push_vertical

Pushes the colliding instance to the appropriate bounding box edge on the vertical axis.

Syntax:

lhc_behavior_push_vertical();

Returns: N/A

Example:

lhc_add("IPushableV", lhc_behavior_push_vertical);

lhc_behavior_stop_on_axis

Stops calling instance on the axis of collision. Does NOT manage x/y velocity variables.

Syntax:

lhc_behavior_stop_on_axis();

Returns: N/A

Example:

lhc_add("ISolid", lhc_behavior_stop_on_axis);