Asset - Scripts Extended Collision Functions

FrostyCat

Member
Extended Collision Functions
Companion scripts for built-in collision functions

Overview

Extended Collision Functions are enhanced versions of built-in collision functions. You can now easily check for collisions with multiple unrelated objects/instances at a time, and optionally pass in a script to ignore instances not meeting certain criteria.

Downloads
YoYo Marketplace: Link
GMS 2.3 and above: Link | Repository
GMS 2.2 and below: Link | Repository

Examples

Checking multiple unrelated object types

GML:
// Can stand on ground and turtles
if (place_meeting_ext(x, y+1, [objGround, objTurtle])) {
    grounded = true;
}
Using a script to include only instances matching certain criteria
GML:
// Die if colliding with a unit from another team
if (place_meeting_ext(x, y, objUnit, function(its, my) { return its.team != my.team; })) {
    instance_destroy();
}
Feedback Welcome!
If you have any suggestions for new constructors/use cases or bug reports, please open an issue or contribute on GitHub.
 
Last edited:

FrostyCat

Member
v1.1.0 is now available for GMS 2.3.0 and above!
  • Updated for GML 2020 compatibility, suchthat parameter can also take methods
  • Added instance_nearest_ext(x, y, objs, [suchthat]) and instance_furthest_ext(x, y, objs, [suchthat])
 
Top