• Game.py
• GenerateArt.py
• GenerateText.py
• RNGHash.py
• Other Resources
This file contains 3 Classes: Enemy
, Player
, GameScreen
.
Starting with Enemy
:
Initializes an Enemy
instance to keep track of enemy instance data.
None
None
Gets a random name for Enemy
instance.
None
name
: type str, the number of rows
Initializes a Player
instance to keep track of player data.
None
None
Initializes the game instance for starting the game.
None
None
Resets the game screen, used to generate the next enemy and starting the game.
None
None
Updates the healthbar visuals on the GUI.
character
: type str, one of "US" (user) or "EN" (enemy)
health
: type int, number of health bars to fill
data
: type Object, healthbar simple GUI.
The logic behind the main game loop.
None
None
Interprets the user action into a move.
event
: type str, the user action on the simple GUI
None
Decides and performs on the enemy action (attack/reload, block)
None
None
Logic for what happens when a player is damaged, including logic for game over.
None
None
Logic for what happens when an enemy is damaged, including logic for defeating the enemy.
None
None
Logic for what happens when the player and the enemy both attack at the same time.
None
None
Taking into consideration player and enemy moves, interprets the outcome.
event
: type str, the user action on the simple GUI
None
This file contains 7 functions for randomly generating the enemy and its art.
The window for changing the file parsed for setting the random seed in art generation.
None
None
The window for changing the file parsed for setting the random seed in art generation.
None
()
: type tuple, the randomly generated RGB tuple.
Blends all colours used nicely.
start_color
: type tuple, random color tuple from random_color().
end_color
: type tuple, random color tuple from random_color().
factor
: type float, factor for interpolation.
()
: type tuple, the interpolated colour.
Makes the black background of an image transparent.
path
: type str, path of target image.
None
Makes the black background of an image transparent.
path
: type str, path of target image.
target_size
: type int, intended size of the generated image.
scale_factor
: type int, intended scale of the generated image.
lines
: type int, intended number of lines
start_color
: type tuple, random color tuple from random_color().
end_color
: type tuple, random color tuple from random_color().
None
Turns a set of images into an animated GIF.
images
: type [], list of image paths for turning into a GIF.
None
Starts the random art generation to create the enemy GIF appearance.
num
: type int, number of images to use in the GIF.
None
This file contains 4 lists, one for nouns, one for verbs, one for adjectives, and one for adverbs. There is 1 function, which uses these lists to generate a random sentence in English.
Generates a random text in the structure of adjective + noun + verb + adverb.
None
String
: type str, random text generated.
This file contains a hash function that is used to create a random seed from a given input file.
Parsing a given file, the file's contents is used for generating the random hash seed.
filename
: type str, path of specified file for seeding.
int
: type int, randomly generated hash number.
This project also relies on these assets for its GUI.
Empty enemy health rectangle
Full enemy health rectangle
Player enemy health rectangle
Player enemy health rectangle
The reused gif for storing the enemy appearance. One is used at a time.