-
<inner> _generic(name, hp, str, def, crit, expgain, sprite, frame, x, y) → {creature}
-
A factory that creates an enemy based upon the given data
Parameters:
| Name |
Type |
Description |
name |
string
|
Creatures name |
hp |
number
|
Health will also become the max_hp |
str |
number
|
Strength |
def |
number
|
Defense |
crit |
number
|
Critical hit ratio |
expgain |
number
|
Experience point gain |
sprite |
string
|
Sprite sheet name |
frame |
number
|
What frame from the spritesheet to use |
x |
number
|
X coordinate of where the sprite is located in the dungeon |
y |
number
|
Y coordinate of where the sprite is located in the dungeon |
Returns:
The created creature object is returned to the caller
-
Type
-
creature
-
<inner> _makePlayer(name, hp, str, def, crit, Class) → {creature}
-
A factory that creates the player based upon the data given
Parameters:
| Name |
Type |
Description |
name |
string
|
Name is 'Player' !!DO NOT CHANGE THIS!! |
hp |
number
|
Health of the player, will also become the max_hp |
str |
number
|
Strength of the player |
def |
number
|
Defense of the player |
crit |
number
|
Critical hit ratio |
Class |
string
|
Name of the class the player is |
Returns:
Returns the created player to the caller
-
Type
-
creature
-
<inner> _pickCreature(level) → {string}
-
Picks a random crature from the proper creature pool.
Parameters:
| Name |
Type |
Description |
level |
number
|
What level of the dungeon the player is currently on |
Returns:
The name of the creature that has been picked to be placed
-
Type
-
string
-
<inner> _putCreature(level, x, y) → {creature}
-
Creates a creature that is to be put into the dungeon. It calls the _pickCreature function to randomly select
a creature. This function creates the randomly chosen enemy and returns that creature.
Parameters:
| Name |
Type |
Description |
level |
number
|
What level of the dungeon the player is currently on |
x |
number
|
X coordinate of where the creature is to be placed. |
y |
number
|
Y coordinate of where the creature is to be placed. |
Returns:
The creature created is returned.
-
Type
-
creature
-
<inner> attack(creature)
-
The playerattacks the creature that is passed to it. Calculations are made to determine damage given.
Parameters:
| Name |
Type |
Description |
creature |
creature
|
The creature that is being attacked |
-
<inner> attack(creature)
-
The creature attacks the creature that is passed to it. Calculations are made to determine damage given.
Parameters:
| Name |
Type |
Description |
creature |
creature
|
The creature that is being attacked |
-
<inner> checkInventorySpace() → {number}
-
Checks if the player has an empty spot in their inventory
Returns:
Returns the index of free space if space is found and -1 if no space is found.
-
Type
-
number
-
<inner> die()
-
Performs any action that must be done upon death (ex. item drop)
-
<inner> fairy(x, y) → {creature}
-
Create a fairy at (x, y)
Parameters:
| Name |
Type |
Description |
x |
number
|
|
y |
number
|
|
Returns:
-
Type
-
creature
-
<inner> interact()
-
Performs any non attack action that the player may do to the creature (ex. talk)
-
<inner> move(_x, _y)
-
Moves the changes the x and y coordinate of the creature
Parameters:
| Name |
Type |
Description |
_x |
number
|
Tells the creature where to move relative to its current position |
_y |
number
|
Tells the creature where to move relative to its current position |
-
<inner> player() → {player}
-
Create the player
Returns:
-
Type
-
player
-
<inner> skeleton(x, y) → {creature}
-
Create a skeleton at (x, y)
Parameters:
| Name |
Type |
Description |
x |
number
|
|
y |
number
|
|
Returns:
-
Type
-
creature
-
<inner> snake(x, y) → {creature}
-
Create a snake at (x, y)
Parameters:
| Name |
Type |
Description |
x |
number
|
|
y |
number
|
|
Returns:
-
Type
-
creature
-
<inner> special()
-
Perform a special creature specific action that isnt an attack. (ex. fairy teleport)