2. Enemy
2. The Enemy Class
2.1 Enemy Initialization
The Enemy
class functions as hostile opponents for the player to battle and interact with. Enemies can be used as regular hostiles or as bosses (special abilities not available yet). Enemies can be used to deliver loot/key items or just to level up the player. Setting up an enemy goes as follows:
You must supply 5parameters when creating an instance of the enemy class:
name
Name of the enemy
hp
The hp amount the enemy will spawn with
minatk
Enemy's minimum attack damage
maxatk
Enemy's maximum attack damage
drops
A list of the possible loot an enemy could drop after death (enter empty list if you don't want drops)
The items in drops
list should be class instances of items, armor, weapons, potions, etc.
Create an enemy like this:
2.2 Enemy.atk
Enemy.atk(opponent)
Preform a basic attack on the opponent. Attack automatically factors in the extra damage from the current weapon the player is holding. If debugging is enabled, the function outputs the total damage done and how much HP the opponent has left. This function is the same as the Player.atk
function, just transferred over to the Enemy
class.
Usage:
2.3 Enemy.say
Enemy.say(text)
Outputs text to the screen to be used as dialogue. The output contains the name of the enemy speaking as well as the text that is set in the parameters.
Usage:
Last updated