This is a Python-based graphical user interface (GUI) application for creating and generating Sokoban game maps. The application allows users to design custom Sokoban levels using different elements like the player, walls, boxes, and targets, and then save these maps as text files.
The GUI is built using the tkinter
library, and users can interactively design maps by clicking and dragging elements on the grid.
- Grid Customization: Define the number of rows, columns, and the cell size of the map grid.
- Element Placement: Place elements such as the Player, Walls, Boxes, and Targets on the grid via simple click or drag actions.
- Save Map: Save the created Sokoban map to a text file in a simple format for future use.
- Python 3.x
tkinter
library (included with most Python installations)
-
Clone the repository:
git clone https://github.com/your-username/sokoban-map-generator.git
-
Navigate to the project directory:
cd sokoban-map-generator
-
Install any dependencies (if required):
pip install tk
-
Open a terminal in the project directory.
-
Run the Python script:
python sokoban_gui.py
-
The graphical interface will appear, allowing you to customize the grid size, place elements, and save the map.
-
Customize Grid:
- Enter the number of rows and columns.
- Adjust the cell size as needed.
- Click "Apply Grid Size" to generate the grid.
-
Place Elements:
- Select an element (Player, Wall, Box, etc.) via the radio buttons.
- Click on a cell or drag the mouse over multiple cells to place elements.
-
Save Map:
- Once done, click "Save Map" to export the map as a text file.
Here is an example of a generated Sokoban map saved as a text file:
OOOOOOOOOOOOOOOOOOOOOOOOO
O R O
O B SO
OO OOOOOO
O B B O
O O
O B S S OOOOO
OO O
O O
O * O
OO OO
OOOOOOO S O
OOO OO
OOOOOOOOOOOOO
Here’s a screenshot of the application in action:
This project is licensed under the MIT License