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

cerinealib Class Reference

cerinealib Class Reference

cerinealib Class More...

#include <cerinealib.h>

Public Member Functions

 cerinealib ()
 Constructor.
void leds ()
 function that switches only the same number of leds on as the same number of lifes the player still have left
void init ()
 function that initialises the values for the main positions as well as the borders to 0(this will be added later when the block are dropped), the sizes to 0(appart from the main first block) because they will be then set in the game,and the x and y position where the blocks to be added will start moving
void draw (N5110 &lcd)
 this function performs two main actuations first, it draws the blocks in movent if their bool variable is true(which means that they were not dropped yet).
void updatescr ()
 depending on if the block is moving (ordinal variables to true) or dropped(ordinal variables to false) it will update the movement from one side of the screen to the next one or it will set the block to the dropped stayed position and when it reaches to five the block count it will start a loop of switching the block x positions to their previous one,letting the game to keep going forever
void commands (DigitalOut &b, DigitalOut &a, DigitalOut &x, DigitalOut &y, Gamepad &pad)
 if buttons pressed the block will be dropped if dropped it will increse the score and let the next block moving variable to true (ordinal variable) as well as setting its to false
void gameover (N5110 &lcd, DigitalOut &start)
 function that displays the game over screen and allows player to restart game once restarted,all values set to original ones
bool die ()
void velocities ()
 function that sets the velocity of the game and the difficulty level the highest the score the faster the game will go and the more difficult
int score ()

Detailed Description

cerinealib Class

Library for the fourth game, Cerinea Revision 1.3

Author:
Mateo Randulfe
Date:
May 2017

Definition at line 46 of file cerinealib.h.


Constructor & Destructor Documentation

cerinealib (  )

Constructor.

Definition at line 7 of file cerinealib.cpp.


Member Function Documentation

void commands ( DigitalOut &  b,
DigitalOut &  a,
DigitalOut &  x,
DigitalOut &  y,
Gamepad pad 
)

if buttons pressed the block will be dropped if dropped it will increse the score and let the next block moving variable to true (ordinal variable) as well as setting its to false

Parameters:
b/a/x/ydrop block
pad

Definition at line 272 of file cerinealib.cpp.

bool die (  )
Returns:
true if dead

Definition at line 448 of file cerinealib.cpp.

void draw ( N5110 lcd )

this function performs two main actuations first, it draws the blocks in movent if their bool variable is true(which means that they were not dropped yet).

second, if they are dropped(bool variables with the names or ordinals like first second etc set to false) the function will leave only the part over the other block and the rest(the part out of the range) will be eliminated.It also sets the size of the next block depending on the size of the block dropped it will set also the left block extreme margin as border to have a reference

Parameters:
lcdfor printing into the screen

Definition at line 100 of file cerinealib.cpp.

void gameover ( N5110 lcd,
DigitalOut &  start 
)

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 54 of file cerinealib.cpp.

void init (  )

function that initialises the values for the main positions as well as the borders to 0(this will be added later when the block are dropped), the sizes to 0(appart from the main first block) because they will be then set in the game,and the x and y position where the blocks to be added will start moving

Definition at line 16 of file cerinealib.cpp.

void leds (  )

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

Parameters:
padcontrols leds
int score (  )
Returns:
score

Definition at line 11 of file cerinealib.cpp.

void updatescr (  )

depending on if the block is moving (ordinal variables to true) or dropped(ordinal variables to false) it will update the movement from one side of the screen to the next one or it will set the block to the dropped stayed position and when it reaches to five the block count it will start a loop of switching the block x positions to their previous one,letting the game to keep going forever

Definition at line 318 of file cerinealib.cpp.

void velocities (  )

function that sets the velocity of the game and the difficulty level the highest the score the faster the game will go and the more difficult

Definition at line 436 of file cerinealib.cpp.