You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
4 months ago | |
|---|---|---|
| assets | 1 year ago | |
| conf | 12 months ago | |
| engine | 4 months ago | |
| sound | 12 months ago | |
| units | 4 months ago | |
| .gitignore | 1 year ago | |
| README.md | 12 months ago | |
| cover.jpg | 12 months ago | |
| get-pip.py | 12 months ago | |
| get-venv.py | 12 months ago | |
| imgui-test.py | 12 months ago | |
| imgui.ini | 12 months ago | |
| maze.json | 1 year ago | |
| maze.py | 1 year ago | |
| opengl.test.py | 12 months ago | |
| pyglet-test.py | 12 months ago | |
| rats | 1 year ago | |
| rats.py | 4 months ago | |
| rats.wasm | 12 months ago | |
| requirements.txt | 4 months ago | |
| sdl2-demo.py | 1 year ago | |
| sdl2-tk-demo.py | 1 year ago | |
| test.html | 12 months ago | |
| test.js | 12 months ago | |
| testwindow.py | 12 months ago | |
| wgdzh | 12 months ago | |
README.md
Mice!
Mice! is a strategic game where players must kill rats with bombs before they reproduce and become too numerous. The game is a clone of the classic game Rats! for Windows 95.
Compatibility
It's developed in Python 3.11, please use it
Features
- Maze Generation: Randomly generated mazes using Depth First Search (DFS) algorithm.
- Units: Different types of units such as rats, bombs, and points with specific behaviors.
- Graphics: Custom graphics for maze tiles, units, and effects.
- Sound Effects: Audio feedback for various game events.
- Scoring: Points system to track player progress.
Technical Details
- Language: Python 3
- Libraries:
sdl2for graphics and window managementPillowfor image processinguuidfor unique unit identificationsubprocessfor playing sound effectstkinterfor maze generation visualization
- Game Loop: The game uses a main loop to handle events, update game state, and render graphics.
- Collision Detection: Each unit checks for collisions with other units and walls.
- Sound Management: Sound effects are managed using the
subprocessmodule to play audio files. - Environment Variables:
SDL_VIDEODRIVERto set the video driverRESOLUTIONto set the screen resolution
- Engine: The game engine is built using SDL2, providing efficient rendering and handling of game events. The engine supports:
- Image Loading: Using
Pillowto load and process images. - Text Rendering: Custom fonts and text rendering using SDL2's text capabilities.
- Sound Playback: Integration with SDL2's audio features for sound effects.
- Joystick Support: Handling joystick input for game controls.
- Window Management: Fullscreen and windowed modes, with adjustable resolution.
- Image Loading: Using
Installation
- Clone the repository:
bash git clone https://github.com/yourusername/mice-maze-game.git cd mice-maze-game - Create a virtual environment:
bash python3 -m venv venv source venv/bin/activate - Install the dependencies:
bash pip install -r requirements.txt - Run the game:
bash python rats.py
Project Files
maze.py: Contains theMazeGeneratorclass for generating and visualizing the maze.rats.py: Main game file that initializes the game and handles game logic.engine/controls.py: Contains theKeyBindingsclass for handling keyboard input.engine/maze.py: Contains theMapclass for loading and managing the maze structure.engine/sdl2.py: Contains theGameWindowclass for SDL2 window management and rendering.units/bomb.py: Contains theBombandExplosionclasses for bomb units.units/rat.py: Contains theRat,Male, andFemaleclasses for rat units.units/points.py: Contains thePointclass for point units.assets/: Directory containing game assets such as images and fonts.sound/: Directory containing sound effects.README.md: This file, containing information about the project.requirements.txt: Lists the Python dependencies for the project..env: Environment variables for the project..gitignore: Specifies files and directories to be ignored by Git.scores.txt: File for storing high scores.