• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Asset - Scripts Extended Collision Functions

FrostyCat

Redemption Seeker
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
GMS 2.3.7 and above: Link | Repository
GMS 2.2.5 and below: Link | Repository
YoYo Marketplace (temporarily out-of-date): Link

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

Redemption Seeker
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