Hi, to handle instance parameters in expressions correctly you need to use a for-each loop.
If you change the way you display whether instances are in collision, for example by changing the color, you will notice that it works, otherwise you need to create a for-each loop and only then create a shapepainter.
It works correctly:
This does not work correctly because the program does not know in the coordinates of which specific instance to create an object, since several of them are in collision at the same time:
This works correctly because we loop through each instance that is in collision and create an object at the coordinates of each one:
Please note that in examples 2 and 3 objects are created every frame, which is not good. To optimize, you need to figure out how to create only one object for each instance or delete unnecessary ones. For example, you can link objects and check if there are any linked objects before creating a new one:
When you use ‘Repeat for each instance of an object’ in GDevelop, it focuses on one object at a time in each loop. That means other instances of the same object are temporarily ignored. So, if you’re checking for a collision, the object might end up checking if it’s colliding with itself, which won’t work as expected.
Your “pick closest to” condition is only working with the current smallblock of the repeat event. That’s why it wouldn’t have worked - the other smallblock objects are not in GDevelop’s reference list of smallblock objects.
The “Pick all instances” will change the reference list to include all the smallblock objects, not just the one current for the repeat event.
so this function where its checking if the checker point is inside the group blocks
works for all group items exept if its the same type as own instance,
So when its a wood block or a glass one it get triggers but when its a stone one its not getting triggerd at all.
I dont understand why its not seeing that even if its part of the group
Because the first condition tells GDevelop to only work with the SmallSquareStone objects that have a timer >= 1 second. So those will be the only SmallSquareStone objects that will checked when you refer to them as blocks members.
To get around this, add a “Pick all instances of blocks” condition before the check for checker point inside blocks.