Collisions between instances, as GameMaker decides them.
An instance collides with the mask of its mask_index sprite, or of its
sprite_index sprite when it has no mask sprite, at the frame image_index shows,
placed at its position with its scale and angle. A sprite without masks collides as
its collision box. An instance with neither sprite collides with nothing.
events/1 runs the step's collision events: for every instance, in creation order,
and every object it has a collision event for, each other instance of that object
(or of an object descending from it) that overlaps it runs the event with that
instance as other. When the other instance is solid, the instance is first put back
where it was at the start of the step; after the event it moves by its speed again
and goes back once more if it still overlaps.
Summary
Functions
The first instance of target whose shape holds the point {x, y}
(collision_point, instance_position, position_meeting); nil for none. target
is an object index (its descendants count), :all, or {:id, id} for one instance.
The world with instance id bounced as GameMaker's move_bounce_solid(advanced)
(against :solid) or move_bounce_all(advanced) (:all) bounces it. Overlapping
something it bounces against, it first goes back to xprevious, yprevious. Simple
bouncing reverses hspeed where a move across is blocked and vspeed where a move
down is blocked, both when both are blocked or when only the move along both is
blocked. Advanced bouncing turns from its direction, rounded to 10°, both ways in
steps of 10° until a move of its speed is clear, and when anything was blocked takes
direction 180 + left + right − direction.
The world after the step's collision events.
Whether instance id, moved to {x, y}, overlaps no solid instance.
Whether instance id, moved to {x, y}, overlaps an instance of object (:all for any).
The first instance of target the segment from from to to passes through
(collision_line); nil for none. target as for at_point/3.
The first instance of object that instance id, moved to {x, y}, overlaps; nil for none.
The shape instance instance collides with at {x, y}, nil for none.
Types
@type target() :: non_neg_integer() | :all | {:id, non_neg_integer()}
Functions
@spec at_point(Cauldron2D.GameMaker.World.t(), {number(), number()}, target()) :: non_neg_integer() | nil
The first instance of target whose shape holds the point {x, y}
(collision_point, instance_position, position_meeting); nil for none. target
is an object index (its descendants count), :all, or {:id, id} for one instance.
@spec bounce( Cauldron2D.GameMaker.World.t(), non_neg_integer(), boolean(), :solid | :all ) :: Cauldron2D.GameMaker.World.t()
The world with instance id bounced as GameMaker's move_bounce_solid(advanced)
(against :solid) or move_bounce_all(advanced) (:all) bounces it. Overlapping
something it bounces against, it first goes back to xprevious, yprevious. Simple
bouncing reverses hspeed where a move across is blocked and vspeed where a move
down is blocked, both when both are blocked or when only the move along both is
blocked. Advanced bouncing turns from its direction, rounded to 10°, both ways in
steps of 10° until a move of its speed is clear, and when anything was blocked takes
direction 180 + left + right − direction.
@spec events(Cauldron2D.GameMaker.World.t()) :: Cauldron2D.GameMaker.World.t()
The world after the step's collision events.
@spec free?(Cauldron2D.GameMaker.World.t(), non_neg_integer(), {number(), number()}) :: boolean()
Whether instance id, moved to {x, y}, overlaps no solid instance.
@spec meeting?( Cauldron2D.GameMaker.World.t(), non_neg_integer(), {number(), number()}, non_neg_integer() | :all ) :: boolean()
Whether instance id, moved to {x, y}, overlaps an instance of object (:all for any).
@spec on_line( Cauldron2D.GameMaker.World.t(), {number(), number()}, {number(), number()}, target() ) :: non_neg_integer() | nil
The first instance of target the segment from from to to passes through
(collision_line); nil for none. target as for at_point/3.
@spec place( Cauldron2D.GameMaker.World.t(), non_neg_integer(), {number(), number()}, non_neg_integer() | :all ) :: non_neg_integer() | nil
The first instance of object that instance id, moved to {x, y}, overlaps; nil for none.
@spec shape( Cauldron2D.GameMaker.World.t(), Cauldron2D.GameMaker.Instance.t(), {number(), number()} ) :: Cauldron2D.Shape.t() | nil
The shape instance instance collides with at {x, y}, nil for none.