That1M8Head / playerobject

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

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

License:Other


Languages

Language:Python 100.0%