Separate two objects(Separate two sprites collision) but instead of separate, it pushes the sprite


#1

Good afternoon everbody, I am working in a new game, it is very simple and I am just getting used to the platform; the game is a simple “tangram” where you put tetris pieces in one place and that’s it; but for the moment I am focusing in the contact between the pieces.

I have manage to collide the sprites between each other (I think) using the “Separate two objects option” but I want to apply the same condition for all the pieces. For the moment I have tested with just two pieces (red and purple):

help

but as you may see in the video it works perfectly when I push red with purple(it jumps the sprite) but when purple hits red it pushes it… I have been changing options but I cannot find yet a way to do it, I will continue working on it, but if anyone has any suggestions I will appreciate it…

Thank you


#2

As a best guess: Your events are basically conflicting with each other (move 3 away from 4, move 4 away from 3) because they’re basically the same, but saying to do the inverse.

You probably need to set up something to indicate which object you’re currently moving (Either a variable, or maybe something like “Mouse is on objectnamehere”) and separate out the events.

Meaning you’d have a parent event of “Mouse is on figure 3 and mouse button is down” with no actions,
But a sub event with a condition of “Figure3 is in collision with figure 4” and an action “Move figure 3 away from figure 4 (figure 4 will move)”
You’d then have another sub event that is similar for each type of figure you have except for figure 3, since it’s the one being moved.

You’d then do the same parent event/sub event set up for each type of figure you have (Mouse is on figure 4 and mouse button is down, etc)


#3

Thank you, will try some of the solutionss, thank you for your time !


#4

Hi, thank you I got it to work, thank you so much !