Skip to content
muneer406Public

About

2D side-scrolling shooter in Python and Pygame, playable in the browser via WebAssembly (pygbag). Built for Hack Club's Campfire Hackathon.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

Rifleman

A 2D side-scrolling shooter built in Python with Pygame: playable directly in the browser via WebAssembly.
Created for Hack Club's Campfire Hackathon.


🎮 Play It

▶ Play in Browser

No installation needed: runs entirely in the browser thanks to pygbag.


✨ Features

  • Handcrafted levels: each built with a custom tile-based level editor
  • Smooth side-scrolling with parallax background layers (sky, mountains, pine trees)
  • Full player move set: run, jump, shoot, and throw grenades
  • Enemy AI: enemies patrol, idle randomly, and attack when the player enters their line of sight
  • Pickups: health packs, ammo crates, and grenade boxes scattered throughout levels
  • Grenade physics: arc trajectory with bounce, fuse timer, and explosion sprites
  • Health bar HUD: real-time health display with colour gradient
  • Screen transitions: cinematic fade-in on level start and pink death fade
  • Win screen: "YOU WIN!" with a replay button after completing all levels
  • In-game restart: press R for a confirmation dialog to restart the current level without losing your place
  • Fully web-compatible: packaged with pygbag for zero-install browser play

🕹️ Controls

Key Action
← / → Move left / right
↑ Jump
Space Shoot
M Throw grenade
R Restart current level (confirmation dialog)
ESC Cancel dialog / Quit

🛠️ Tech Stack

Technology Purpose
Python 3.13 Core language
Pygame-CE Game engine (rendering, audio, input)
pygbag WASM packaging for browser play
CSV Level data storage

🗂️ Project Structure

Shooter/
├── main.py              # Main game: full game loop, all sprite classes
├── button.py            # Reusable Button class
├── level_editer.py      # Visual tile-based level editor
├── level1_data.csv      # Level 1 tile map (16 × 150 grid)
├── level2_data.csv      # Level 2 tile map
├── level3_data.csv      # Level 3 tile map
├── audio/
│   ├── music2.ogg       # Background music
│   ├── jump.ogg
│   ├── shot.ogg
│   └── grenade.ogg
└── img/
    ├── player/          # Idle, Run, Jump, Death animations
    ├── enemy/           # Idle, Run, Jump, Death animations
    ├── tile/            # 21 tile types
    ├── explosion/       # Explosion animation frames
    ├── background/      # Parallax layers
    └── icons/           # UI icons (health, ammo, grenade)

🚀 Run Locally

Prerequisites: Python 3.11+ and pip

# Clone the repo
git clone https://github.com/your-username/shooter.git
cd shooter

# Install dependencies
pip install pygame-ce pygbag

# Run the game
python main.py

🌐 Build for Web

# Build the WASM package
pygbag --build main.py

# The output is in build/web/: zip and upload to itch.io
Compress-Archive -Path "build/web/*" -DestinationPath "shooter_web.zip"

🗺️ Level Editor

The project includes a standalone level editor (level_editer.py) used to design all levels:

  • Paint tiles onto a 16 × 150 grid using all 21 tile types
  • Scroll horizontally to build wide levels
  • Save directly to CSV format loaded by the game
python level_editer.py

🏕️ About: Hack Club Campfire Hackathon

This game was built for Hack Club's Campfire Hackathon. The goal was to create a fully browser-playable game from scratch: level design, sprite animation, enemy AI, physics, and audio: all within the hackathon window.


📄 License

MIT License

About

2D side-scrolling shooter in Python and Pygame, playable in the browser via WebAssembly (pygbag). Built for Hack Club's Campfire Hackathon.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages