Help to find the side collision

Hello guys, i need your help. How i can use:

if the object X colide on left of object X do it. (yes i can colide one sprite X with one duplicate of sprite X)

I think, i can place 4 sprites to locate a direction of collision. But i have to place a lot of sprites with this. I need other solution. I’m trying to make an effect like a the sims or Minecraft. if one block is on side so they change to other animation (border).

I create other solution but, not works for obviously ways. If Sprite is on collision to Sprite and positionSprite is > Sprite.X change the animation of Sprite to 1.

Sorry for my English. :frowning:
rect4160.png

You can’t test collisions (or any object-object test) with the same object, this is something like a limitation from the engine and was one of my first request (object variables, not variables “inside” objects, but variables treated as objects) :smiley:

But, if you also need to detect the collision border, maybe you can emulate an algorithm to check rectangle collisions plus edge detection:
First, choose (through conditions) the first object, and save its position and size (or position only if the size is constant) in variables. Then, choose the second object, and launch the algorithm, you have all the information you need (both object’s position and size).
I can’t find this GD example, but I remember I was able to do it with one of the first Google results :wink:

Thanks Bro :slight_smile: