Testing for collision between dragged instance and all other instances

Game with multiple instances of 7 different varieties of sprites with complex shapes like “U” and “Z” type shapes, so the physics collision mask won’t work as it cannot be convex and cannot have multiple masks on the same sprite. Any piece can be dragged from one location to another. This is all done on a grid using the rectangular grid extension.

Is there a way of testing for a collision between the currently dragging sprite and all other instances?

Also, when I got it to work with non instances there was some real weirdness going on, with one sprite ‘getting stuck’ over another and then vibrating while moving slowly till it was finally off. Is there a better way people are using to get the dragging sprite to just stop moving before it hits another?

Using physics2 is out because I cannot make a complex collision mask to allow for the interlocking of the U and Z shapes.

I tried breaking the pieces into their individual squares but then getting them all to move as a single unit was complicated and I couldn’t figure out how to allow the user to add new pieces that were then at times as many as 7 squares.

I was hoping there was an easier way, something I was missing.

Hi David. What’s the goal or rules of your project. It’s all a bit vague and any response is going to be a guess. It helps if you post a screenshot of the events that you’re using to drag the objects. Are you using the drag behavior or doing it through events?

this is a puzzle of sorts, but with a variety of pieces you can assembly. Think something like tetris, but without gravity, timer or randomness.

So you would have a menu to the side with a variety of U and Z type shapes. Many would be much more complex, which is one of the reasons why I want to avoid having to make them all from separate simple sprites. You click on an item in that menu and you get a sprite dropping on to the playing surface/screen. It would then be draggable.

The only rules would be that the shapes cannot overlap. At least at first. I’m thinking of more complex rules, but want the basic system working first.

I don’t really have a lot set up right now. I’ve got two sprites with complex shapes and multiple collision masks. Each has ‘draggable’ set in behaviors and a single event to snap the sprites to a grid.

I tried using the draggable physics extension which kept the sprites from hitting each other, but didn’t allow them to interlock.

I then tried to break them down into single squares and had them move as an single object by connecting x and y coordinates and that was working, but the task of having to build all these increasingly complex shapes and then associating all those pieces seems daunting, especially if there is an easier way.

I also didn’t see a way of spawning the new pieces from the menu with all their squares x and y coordinates associated already.

I’ve never had much success with separating objects. Maybe someone else can help. You mentioned you’re using a grid. How large is the grid? The size of the object or a portion.

I really think a screenshot of the project in action or movement events will help people get a better understanding of your goal. Nobody is here to judge only help.

You actually can make custom collision masks using multiple masks:


Maybe use something like this to separate the objects?