GML How to find out all values in the array as one function?

E

Edwin

Guest
How to find out all values in the array as one function?

For example:

I made an array that will keep objects that can collide player.
Code:
solidObject[0] = oWall;
solidObject[1] = oBox;
I want to make collision with all these objects in "solidObject" array but not separately.
Code:
if (place_meeting(x, y, ALL OBJECTS IN "solidObject" ARRAY)) {
    hspeed = 0;
    vspeed = 0;
}
Please help! Is there any scripts or functions for do this or something?!
 
H

Homunculus

Guest
As @Carl Nylander said, you generally solve this by using a common parent. If that's not an option, you can always loop over every object in the array and check for a collision inside the loop
 
Top