I would like to create an condition that checks if an object is in collision with more than one of the same object. Eg. I have a box that moves in relation to my player on a grid map. It activates an event in the tile when it comes in contact. However, when I am on a ladder the box can move over two squares at the same time. It activates the event in one (by deleting and replacing the object) but it just deletes the other tile to show plain scene background (I patched the background with a picture but now my map is full of mole holes LOL).
Any tips to put in a condition that recognises when in contact with only 1 tile?
Not easy to answer without basic clear example in gdevelop of what you have and what you want, but there are severals options to do it…
If you want trigger an event on multiple collision, you can use variables :
For each object MyObject :
Collision : Do once : +1 to scene variable MyVar
In another event, you’'l trigger the action you want by checking :
MyVar is => 2
It’s an idea but not perfect, because you’ll have to do -1 for each objet wich was in collision and wich is not anymore.
Maybe there is an option with a condition/action i’ve never used wich count number of object.
Also, and maybe the best (at last what i think i would use) : object variables
just create a var on your object named for example “isInCollision”, set it to “1” when the object in collision, and to 0 when it’s not.
Then, if 2+ objects are in collission and their var to “1”, it’s done.
Sorry if it’s unclear, idk what’s “level” with Gdevelop or with algo in general, the best is to make a commented example.
Thanks for the help! I solved it with a combination of variables as above. Useful things variables