Just check if the place on the top, left, bottom or/and right of the yellow cube is free.
Add a helper sprite (just a 1x1 px sprite) for collision / overlapping check. Then set the position of this helper spriter in all directions of the yellow cube (when the player is over that) and check if the helper is overlaying or collision a wall. If not the player can pass it.