Lens
Member
Hello, good morning/afternoon/evening!
I'm using a collision rectangle to identify other object instances around the room, and, while there is any of those specific objects touching/being inside the rectangle, the main character (whose posseses the collision rectangle) will change a variable ("collidedL") value in the Step event.
When collidedL = 1, he won't be able to move left, for example. Now, I have similar other objects (ObjectB, ObjectC...) that will do precisely the same (once in collision with nomoveleft recantle, will trigger the collidedL to be 1 aswell).
I have tried duplicating the code, changing the collision_rectangle object of focus to those other ones, however, when I do that, not only the code gets rather heavy (since there are quite a few different objects) but also the multiple rectangles tend to not work properly, since multiple instances of the same name are being run at the same time (I guess...?). Any ideas onto how to make it work?
I'm using a collision rectangle to identify other object instances around the room, and, while there is any of those specific objects touching/being inside the rectangle, the main character (whose posseses the collision rectangle) will change a variable ("collidedL") value in the Step event.
nomoveleft = collision_rectangle(x - 5, y - 85, x - 25, y - 5, ObjectA, false, false);
if nomoveleft != noone
{
collidedL = 1;
}
else collidedL = 0;
When collidedL = 1, he won't be able to move left, for example. Now, I have similar other objects (ObjectB, ObjectC...) that will do precisely the same (once in collision with nomoveleft recantle, will trigger the collidedL to be 1 aswell).
I have tried duplicating the code, changing the collision_rectangle object of focus to those other ones, however, when I do that, not only the code gets rather heavy (since there are quite a few different objects) but also the multiple rectangles tend to not work properly, since multiple instances of the same name are being run at the same time (I guess...?). Any ideas onto how to make it work?