A 2D side-scrolling platformer game built with Python and Pygame, featuring tile-based levels, enemy AI, projectile combat, particle effects, and a built-in level editor.
- Platformer Mechanics — Run, jump, wall-slide, and dash through hand-crafted levels
- Combat System — Enemies patrol and shoot projectiles; dodge or defeat them to survive
- Particle & Spark Effects — Leaf particles, hit sparks, and dash trails bring the world to life
- Multiple Levels — 3 progressively challenging maps (with support for more)
- Level Editor — Design your own levels with the included tile-based map editor
- Sound & Music — Ambient sounds, jump/dash/hit/shoot SFX, and background music
- Screen Shake — Dynamic camera shake on impacts for satisfying game-feel
- Cloud Parallax — Scrolling cloud layers add depth to the background
Add your gameplay screenshots here!
| Technology | Purpose |
|---|---|
| Python 3 | Core language |
| Pygame | Game engine / rendering |
| JSON | Level/map data storage |
first-game/
├── game.py # Main game entry point (Adventure class)
├── editor.py # Built-in tile map editor
├── game.spec # PyInstaller build spec
├── music.wav # Background music
│
├── scripts/ # Game engine modules
│ ├── entities.py # Player, Enemy & PhysicsEntity classes
│ ├── tilemap.py # Tile map loading, rendering & physics
│ ├── cloud.py # Parallax cloud system
│ ├── particle.py # Particle effects
│ ├── spark.py # Spark/flash effects
│ └── utils.py # Image loading & Animation helpers
│
├── maps/ # Level data (JSON)
│ ├── 0.json # Level 0
│ ├── 1.json # Level 1
│ └── 2.json # Level 2
│
├── Surface_data/ # Tile & sprite assets (PNG)
│ ├── PNG/ # Sprite sheets & individual tiles
│ └── License.txt # Asset license
│
├── sfx/ # Sound effects
│ ├── ambience.wav
│ ├── jump.wav
│ ├── dash.wav
│ ├── hit.wav
│ └── shoot.wav
│
├── build/ # PyInstaller build output
└── dist/ # Distributable executable
- Python 3.7+
- Pygame
-
Clone the repository
git clone https://github.com/devkumar2313/first-game.git cd first-game -
Install dependencies
pip install pygame
-
Run the game
python game.py
-
Run the level editor (optional)
python editor.py
| Key | Action |
|---|---|
← / → (Arrow Keys) |
Move left / right |
↑ (Arrow Key) |
Jump |
X |
Dash |
| Key / Input | Action |
|---|---|
A / D |
Scroll left / right |
W / S |
Scroll up / down |
Left Click |
Place tile |
Right Click |
Remove tile |
Shift + Click |
Place off-grid tile |
Scroll Wheel |
Change tile variant |
T |
Save map |
G |
Toggle grid mode |
A game.spec file is included for PyInstaller:
pip install pyinstaller
pyinstaller game.specThe executable will be generated in the dist/ folder.
- Launch the editor:
python editor.py - Use the controls above to place grass, trees, bushes, and enemy spawners
- Press
Tto save your map as a JSON file in themaps/directory - Update the level count in
game.pyto include your new map
Adventure (game.py)
├── Player ← controlled by keyboard input
├── Enemy[] ← AI-driven patrol & shooting
├── Tilemap ← collision & rendering from JSON maps
├── Clouds ← parallax background decoration
├── Particles[] ← leaf & hit particle effects
├── Sparks[] ← projectile impact flashes
└── Projectiles[] ← enemy-fired bullets
Key systems:
- Physics — Gravity, velocity, tile-based collision detection
- Animation — Frame-based sprite animation with configurable duration
- Camera — Smooth follow with screen-shake support
- Level Loading — JSON-based tilemaps with spawner entities
Contributions are welcome! Feel free to:
- Fork the project
- Create a feature branch (
git checkout -b feature/awesome-feature) - Commit your changes (
git commit -m 'Add awesome feature') - Push to the branch (
git push origin feature/awesome-feature) - Open a Pull Request
This project's code is open source. Game assets in Surface_data/ are subject to their own license.
devkumar2313 — GitHub Profile
Made with ❤️ and Pygame