I have the following scene:
two circles 64x 64
with the following events:
I get this:
Why does the circle on the left sink further than the one in the right, all the circles are supposed to stop right on the edge… I tried forces, tried without the repeat for each object condition…
The objects are moving in the Y direction 16 pixels at a time as long as they’re not colliding. The code stops moving the objects after they collide. So, they’ll overlap somewhere between 1 and 16 pixels depending on how close they are in the frame right before the collision happens. Since the 2 objects start at a different Y() value, they’re “stopping” at different places.
The second for each does nothing because it just sets the x,y of the objects to their current values.
Alternate methods would be to check the Y() values, use separate objects with a boolean variable or use the physics behavior. Any of which can be searched for or discussed further here.