Mateo Gomez-Randulfe / Mbed 2 deprecated The_Children_of_Cronos

Dependencies:   mbed

Fork of The_Children_of_Cronos_el15mggr by ELEC2645 (2016/17)

Embed: (wiki syntax)

« Back to documentation index

Stymphalianlib Class Reference

Stymphalianlib Class Reference

Stymphalianlib Class. More...

#include <Stymphalianlib.h>

Public Member Functions

 Stymphalianlib ()
 Constructor.
void gameover (N5110 &lcd, DigitalOut &start, Gamepad &pad)
 function that displays the game over screen and allows player to restart game once restarted,all values set to original ones
void updatescr ()
 updates the alien bullets and player bullets movement also, it only allows to generate the bullet if the alein is on the screen uses disp variables for knwing where to display the bullet(from an alive alien) uses alienbullet variables for knowing if there is any bullet of that type already in the screen(in that way no bullet will be generated untill there is no bullet in the screen
void commands (Gamepad &pad, DigitalOut &l, DigitalOut &b, DigitalOut &x, DigitalOut &r)
 allow player to move the spacecradt horizontally within the screen as well as to shoot only if there is no players bullet already in the screen
void init ()
 function that initialises the values for the main positions it initialises all the array alien x and y positions sets no bullets bool on the screen and disp to true
void draw (N5110 &lcd)
 main draw function that draws all the component of the game it also clears some aliens and bullets pixels for improving appearance
void touch ()
 checks if the palyers bullet hits any alien checks if any alien bullet hits player
void leds (Gamepad &pad)
 function that switches only the same number of leds on as the same number of lifes the player still have left
void move ()
 function that moves 1 pixel the y alien position.Ready for being used by a ticker in the main file in this way the aliens will move one pixel per second
bool destruction ()
 checks if any alien alive arrived to the players height(in this way it will kill the player)
void auxiliar ()
 generates aliens bullet if no bullet in the screen (by checking alienbullet variables) randomly generated bullets
int score ()
bool die ()

Detailed Description

Stymphalianlib Class.

Library for the second game Revision 1.3

Author:
Mateo Randulfe
Date:
May 2017

Definition at line 45 of file Stymphalianlib.h.


Constructor & Destructor Documentation

Constructor.

Definition at line 7 of file Stymphalianlib.cpp.


Member Function Documentation

void auxiliar (  )

generates aliens bullet if no bullet in the screen (by checking alienbullet variables) randomly generated bullets

Definition at line 465 of file Stymphalianlib.cpp.

void commands ( Gamepad pad,
DigitalOut &  l,
DigitalOut &  b,
DigitalOut &  x,
DigitalOut &  r 
)

allow player to move the spacecradt horizontally within the screen as well as to shoot only if there is no players bullet already in the screen

Parameters:
b/x/padspacecraft horizontal movement
l/rshoot from left or right

Definition at line 128 of file Stymphalianlib.cpp.

bool destruction (  )

checks if any alien alive arrived to the players height(in this way it will kill the player)

Returns:
true if any alien reached the players position
false if not

Definition at line 103 of file Stymphalianlib.cpp.

bool die (  )
Returns:
true if dead
false if not dead

Definition at line 12 of file Stymphalianlib.cpp.

void draw ( N5110 lcd )

main draw function that draws all the component of the game it also clears some aliens and bullets pixels for improving appearance

Parameters:
lcdfor drawing into the screen

Definition at line 354 of file Stymphalianlib.cpp.

void gameover ( N5110 lcd,
DigitalOut &  start,
Gamepad pad 
)

function that displays the game over screen and allows player to restart game once restarted,all values set to original ones

Parameters:
lcdfor drawing into the screen
startfor restarting the game
padfor putting leds off

Definition at line 274 of file Stymphalianlib.cpp.

void init (  )

function that initialises the values for the main positions it initialises all the array alien x and y positions sets no bullets bool on the screen and disp to true

Definition at line 22 of file Stymphalianlib.cpp.

void leds ( Gamepad pad )

function that switches only the same number of leds on as the same number of lifes the player still have left

Parameters:
padcontrols leds

Definition at line 183 of file Stymphalianlib.cpp.

void move (  )

function that moves 1 pixel the y alien position.Ready for being used by a ticker in the main file in this way the aliens will move one pixel per second

Definition at line 168 of file Stymphalianlib.cpp.

int score (  )
Returns:
die if dead variable is true
score

Definition at line 484 of file Stymphalianlib.cpp.

void touch (  )

checks if the palyers bullet hits any alien checks if any alien bullet hits player

Definition at line 192 of file Stymphalianlib.cpp.

void updatescr (  )

updates the alien bullets and player bullets movement also, it only allows to generate the bullet if the alein is on the screen uses disp variables for knwing where to display the bullet(from an alive alien) uses alienbullet variables for knowing if there is any bullet of that type already in the screen(in that way no bullet will be generated untill there is no bullet in the screen

Definition at line 394 of file Stymphalianlib.cpp.