View Issue Details

IDProjectCategoryView StatusLast Update
0025162Runner SuggestionsFunctionsPublic2018-05-09 10:36
ReporterzenAssigned To 
Status NewResolutionOpen 
Platform OS OS Version
Summary0025162: Suggestion: Functions: [Return ids for all colliders from collision functions, not just the first one found]
DescriptionThe collision functions that return an id(instance_place(x, y, object), instance_position(x, y, object), collision_point(x, y, object, precise, notme)...) only return one single id when they find a collision with more than one instance, so if you want to address the rest of the colliding instances you have to write scripts that check repetitively with varying conditions, impacting performance considerably.

My request is that these functions should return an array or a data structure containing the ids of all instances which are found to be colliding with the calling instance, so thereĀ“ll be no need to call them more than once for every check.
Additional InformationOriginal helpdesk ticket:
TagsNo tags attached.


Russell Kay

2017-01-19 15:57

Manager   ~0051230

This one is open for discussion on how we would implement it, open to ideas.


2017-01-20 15:07

Updater   ~0051248

The return values for these are already well-defined and deeply entrenched in popular use, so there is no place for overriding them. A better idea is to implement them as new, separate functions:

- instances_place()
- instances_position()
- collisions_point()
- collisions_line()
- collisions_rectangle()
- collisions_circle()
- collisions_ellipse()

Joakim Tornhill

2017-01-20 19:46

Reporter   ~0051252

Really would like to have the functionality raised above as well.

How about an optional true/false flag in the end of these functions where true means all in area? If using true the result will give a number that works like an object and reference to an Array of instances. Then you just use functions like instance_number(reference) and instance_find(reference,index)... exactly as you do with an object.

Mark Alexander

2017-01-20 22:07

Developer   ~0051253

Last edited: 2017-01-20 22:10

View 2 revisions

I have already filed this and given my suggestions for how it should be handled here:

I suppose instance_place_list and instance_position_list should also be added to those too...


2017-01-25 15:33

Adminstrator   ~0051321

Mark's report:

I would like to suggest that the following functions be added:


They would work exactly the same as the regular collision functions, but have an extra final argument where the user supplies a DS list that would be populated by the instances detected in the collision.

For the collision_point list, the list would be ordered by depth, for collision line, the list would be ordered by distance from point x1/y1 to point x2/y2, for collision_circle the list would be ordered by distance from the center and for collision_rectangle/ellipse the list needn't be ordered (mainly because I can't think of any actual way to order it that would make sense :P ).

Note that the other collision functions could also be given list counterparts, but in general I've only seen these functions get requests for this type of return list, since they are most commonly used for things like lasers and explosions, where a list of instances is useful and required.


2017-01-30 15:26

Updater   ~0051371

I would prefer to see this feature implemented to return arrays instead of lists. This way we can leave the cleanup to the garbage collector.