Giter Club home page Giter Club logo

python-2d-game's Introduction

python-2d-game

This is a simple 2D action RPG game that lets you control a character and fight against different monsters, using potions and abilities to your advantage.

In-game footage (YouTube):

in-game footage

Screenshots:


Choose your hero:


Master different abilities:



Equip powerful items:



Customize your character with talents:




Interact with NPCs:


Installation

This project uses Python3.

The library Pygame is also used.

To install pygame:

pip install -r requirements.txt

Playing the game

Simply run

./run.py

Generating an executable file

To generate an executable that can be run without having Python installed:

pyinstaller run.spec

(The file run.spec has been generated by pyinstaller and then manually modified to include a resource directory.)

The executable has to be run from the terminal, and you have to cd into the directory before executing it.

Launching the map editor

Simply run

./map_editor.py

or to edit a specific map

./map_editor.py --map test.json

Gameplay basics

  • Use arrow keys to move
  • Use keys shown in UI to use abilities and consumables
  • Use spacebar to interact with NPCs and other entities in the environment
  • Press 'Enter' to pause the game
  • Press 'S' to save your progress

Advanced usage

To play a specific map, run

./run.py --map test.json

or with a specific hero

./run.py --hero MAGE
./run.py --hero ROGUE
./run.py --hero WARRIOR

To start the game without it being fullscreen, run

./run.py --disable_fullscreen

There may be more flags to use for debugging purposes.

Profiling the game:

To profile the game code, run:

./profile_game.sh

You will be running the game through cProfiler, and when you're done stats will be printed and saved to a file.

If you're using a mac and the game is running at a very low framerate, it may be due to an issue with Pygame and Retina displays. Follow these instructions to open Python in low-resolution mode: https://support.apple.com/en-us/HT202471. (For me it led to a big performance improvement.)

python-2d-game's People

Contributors

jonathanmurray avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.