Skip to content

muneer406/rifleman

Folders and files

NameName
Last commit message
Last commit date

Latest commit

18e2998 · · Mar 1, 2026

History

3 Commits
Mar 1, 2026
Mar 1, 2026
Mar 1, 2026
Mar 1, 2026
Mar 1, 2026
Mar 1, 2026
Mar 1, 2026
Mar 1, 2026
Mar 1, 2026
Mar 1, 2026

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)
h, 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.pyy

🌐 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

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages