Sokoban like logic


im making a sokoban like game and this is the code i use for moving and for some reason it only works if theres one instance of a box if theres 2 it breaks and ive already tried making the inversions nots it still doesnt work

Can you be more specific? Do you mean 2 boxes in a row, or just 2 boxes in the scene?

having 2 boxes in the scene makes it go from working perfectly to i can walk through boxes and the player cant interact with them at all

The reason will be the inverted point inside box. The point may be inside the first box, but it’s not inside the second box so the condition is true and the player is moved.


Here's a solution using the new(ish) else event:

The logic here is along the lines of:

is the point in a box?
  -> yes, check is further point in a second box?
    -> no, move first box and player
  -> no (point not in first box), move the player only
1 Like

Thanks it works perfectly!