![]() ![]() The code for copying the current level is reused, so a function is made. When the r key is pressed the level is reset. ,Ĭurrent_level = 0 level = epcopy( levels) # etc. For now, a single level is stored, and a square is drawn for every cell which isn't a space (i.e. Coding Drawing a levelĮach level is stored as a grid of strings. If there are no boxes left which aren't on storage locations then the level is complete. If the position adjacent to the player is a box and the position beyond the box is movable, the grid is changed to reflect the new player and new box positions. empty or a storage location), the values of the grid are changed to reflect the new player position. If the position on the grid adjacent to the player in the direction of the arrow pressed is movable (i.e. When an arrow key is pressed, the grid is looped through to find where the player is. A good looking puzzle game with levels that become increasingly tougher and more complex as you play. The level is stored as a grid of these strings. Enjoy a huge collection of Sokoban levels and skins, complete with a variety of import tools and t. The different states a cell can be in are represented by the following strings: on storage Push all the boxes on to the storage locations.īoxes can only be moved if there is a free space beyond it (not a wall or another box). The levels used in this tutorial are from Rockbox. Home page > Pygame Zero tutorials SokobanĪ tutorial for Python and Pygame Zero 1.2
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |