Details:
Genesis is a 2D indie game written in Ruby using the Gosu module. Game objective is to kill all mobs (skulls) possible.
The player will be able to switch gravity and summon a 1st POV gun.
Controls:
Key | Action |
---|---|
W | Switch player (and pet) gravity upwards |
A | Player (and pet) move backwards |
S | Switch player (and pet) gravity downwards |
D | Player (and pet) move forward |
SPACE | Enable scope |
CLICK LEFT | Shoot |
CLICK RIGHT | Reload |
Field Name: Layer
Type: Class
Notes: Will import and initialize all graphical media used in the program. Will also be the parent class to various other classes.
Field Name: Character
Type: Class
Notes: Will Inherit Layer class, and will contains all characteristics
that a character would have.
Field Name: Accessories
Type: Class
Notes: Will inherits Layer class, and will contains all characteristics that the “magical elements” (portals and carrot) would require.
Field Name: Audio_used
Type: Class
Notes: Will imports and initialize all audio that would be used in the program.
Field Name: Number_use
Type: Class
Notes: Will have instances to store current starting coordinate information for the number sprite file and the difference in x and y coordinate from the live-mouse-coordinates
Field Name: Result
Type: Class
Notes: Will maintain a record of player health, score, time spent and ammo used.
Field Name: Genesis
Type: Class
Notes: Will inherit Gosu::Window and will be used to call all the functions and procedures defined.
The code uses the following inbuilt and external libraries-
- Gosu - the base of the game.
- Colorize - to output fancier terminal instructions.
- Threads - to run different methods at (kind of) simultaneously.
Game uses a bunch of substances to make things look fancier and less static. These substances are:
- player character
- pet character - will follow the player around
- backgrounds - layers of various images to give depth
- elements - things such as portal
- skull - game mob
- scope - for gun functionality
- result - game statistics for the player
To make the code cleaner, each of these substances will be modularized in their own separate script-files, and one main file- Genesis.rb
will call and use them.
The initialize method will define (mostly) all instance variables that the main class- Genesis will use.
These variables would be later used as parameters for different functions and procedures in other Gosu methods (update
, draw
, button_up(id)
and button_down(id)
).
Will take care of controls and movement and basically everything dynamic in the game as long as ammo and health is not less than or equal to 0.
Will draw all the substances. Some substances would be drawn only if certain condition is matched.
Will be used to put certain functions/procedures on loop(like function for player’s movement sound), and increment values for the substances which are supposed to update only on player’s interaction.
Will be mainly used to stop all the loops started by button_down(id).