Hello everyone, I decided to join the general madness. In 30 lines we have already written almost everything that we could, but I did not find the good old Sokoban (I probably did not search well), so I want to fill this gap.
Fiddle link
If someone does not know, the point is to push the boxes to the specified places. Boxes can only push, you can not pull. At the same time you can push in front of only one box. The walls of the maze are painted black, the boxes are blue, the places for the boxes are gray, the boxes standing in the right places are red, the player is green. Control cursor arrows.
')
The level map is set in the levelData array at the beginning of the script.
Symbols used:
- 'w' - wall
- 'b' - box
- 's' or space - free space
- 'y' - player