Skip to content

Repository files navigation

Introduction

This is a template for a game using Pygame-ce that can run in both desktop and browser.

screenshot

This project is based on Matt Owen's tutorial:

Pygame ARPG Tutorial Series

Ninja sprite is from the same author:

Monochrome ninja

Cursor by:

Precision icons created by redempticon - Flaticon

TOC

Features

  • runs in web (itch.io and GitHub Pages) thanks to pygbag
  • implemented fine state machin
  • usage of menus pygame-menu (patched - gfxdraw not working in WEB)
  • partial mouse support (in menus)
  • Tiled map loading pytmx
  • Map reloading, scrolling and zooming pyscroll
  • map with layers (occlusion and collision)
  • custom mouse cursor
  • animated sprites
  • separation keys from actions
  • scene transitions
  • automatic screenshots

Ideas for future

  • list key bindings
  • add enemies
  • add fog of war and/or line of sight
  • add particles system
  • screenshot of menu not working (showing only part of menu)
  • some key events are lost (action is repeated even key is not pressed in menus)
  • continuing game after exiting menu causes loosing player's position on small map (works on grassland though)
  • should new map be a new game state?

Installation

# create venv
python3 -m venv .venv
# activate it
# on Linux/MacOS
source .venv/bin/activate
# on Windows
.venv\Scripts\activate

# install packages
pip install -r requirements.txt

Run

Desktop mode:

cd project
python main.py

Browser mode:

# from top level folder
pygbag --ume_block 0 project

open http://localhost:8000/ in browser

use http://localhost:8000#debug to show Python repl terminal in browser - useful for troubleshooting

Deploying

full instruction here

in short:

pygbag --ume_block 0 --archive project

upload 'build/web.zip' to itch.io or any other hosted site.


To GitHub pages

full instruction here

About

Boilerplate pygame-ce project for a top-down tiles sheet based RPG game that can run in the browser.

Topics

Resources

Stars

11 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages