Which way to go for my puzzle

Hey guys !

I am designing a puzzle and wonder what is the better way to deal with it.
I know there is different technics, events, behaviour and would like the best choice.

The puzzle is inspired from the Rush Hour game (in which you have to get a specific car outside of a board, by mooving other cars) but always has different rules.

Here is a quick look of the puzzle :

There is different kind of blocs. The one in the middle is the one player have to get out of the area, area represented by the green line (there is also a floor, not included in the screenshot, and a hole to get the target bloc exit).
Other blocs have different movement. Some only goes verticaly with no limitation, some horizontaly, some goes verticaly with a movement of only one unit (still need to define this unit), some can goes verticaly AND horizontaly etc …

Blocs cant get through each other or through the green line.

My question is, how to deal with of my specifications ?

Right know, my blocs are sprites with a draggable behaviour. They move from space to space, like if they were on a grid. I check if the dragged bloc is not colliding with another bloc, if so, it cant be dragged any futher in this direction. I also check the X minimum and maximal value, for the bloc which can only move for a specific number of unit.
I didnt finish all the events, but here is a quick look :

Am I doing wrong ? Is there another better choice, with less events to set ? Something with physics engine ?

I hope I am clear enough and sorry for my english =p

Thank you very much

As it stands currently, you are moving blocks apart every single frame. In one event you’re moving block1 from block11, and in a following event your reversing this, moving block11 from block1 when you separate them. This can lead to strange behaviours.

I’d suggest checking for a collision with the dragged object and another block, and only then move the blocks apart.

Thanks ! How do I check for their collision please ?

Use the collision event condition for an object - Select ‘Add condition’, click on Block1, select Collision and click on block11. Presto! You’re now checking whether block1 & block11 collide.

1 Like

Thanks a lot ! I’ll give it a try as soon as I can, very busy =p