GithubHelp home page GithubHelp logo

that1m8head / playerobject Goto Github PK

View Code? Open in Web Editor NEW
2.0 0.0 0.0 78 KB

A command-line turn-based RPG engine written in Python. Comes with a demonstration file.

License: Other

Python 100.00%
game python module python3 python36 rpg-engine game-engine command-line

playerobject's Introduction

Basic RPG engine Run on Repl.it

Files

The Python file PlayerModule.py in this repo contains the code for a W.I.P. game engine. This repo will eventually grow to form a whole game engine, but for now it just holds my early code.

DefaultPlayer.py is a separate file that is used to demonstrate how PlayerModule.py can be used.

Prerequisites

Running the code online

You can use repl.it via the button above to run the code without downloading anything. Feel free to experiment with DefaultPlayer.py.

Running the code on your computer

If cloning/downloading the repo to your computer, you'll need at least Python 3.6, as PlayerModule.py uses f-strings. The latest version of Python is recommended.

How to use the module

To create a new player, simply type

import PlayerModule
Player = PlayerModule.PlayerObject(PlayerName, PlayerHealth, PlayerAttack, GameName)

Keywords

PlayerName - The name of the player. Will be used in most dialogues.

PlayerHealth- The maximum health of the player.

PlayerAttack - The base attack strength of the player. Actual attack strength is determined by an RNG value ranging from base attack to double base attack. For example, if base attack is 15, a full-strength attack would be 30.

GameName - The name of the game to be printed upon creating a new player in the format "Welcome to {GameName}, {PlayerName}!".

The above function will later be included in a GameProperties object, which doesn't yet exist

The PlayerObject object has three attributes - Attack(), Damage(InitialDamageAmount) and Heal(HealAmount)

Player.Attack() - Performs an attack as described earlier. Only prints out how much damage is dealt as of now, and does not damage any enemies, as there are none.

Player.Damage(InitialDamageAmount) - This works the same as Player.Attack(), but instead of dealing damage to any enemies, it deals damage to the player. Unlike the aforementioned Player.Attack()'s attack points, Player.Damage()'s InitialDamageAmount can be tripled.

Player.Heal(HealAmount) - Simply heals the player by the specified amount. If HealAmount is greater than or heals to a value greater than the player's max health, it sets the player's current health to max.

playerobject's People

Stargazers

 avatar  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.