FINAL VERSION

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Brick Class Reference

Brick Class Reference

Brick Class. More...

#include <Brick.h>

Public Member Functions

 Brick ()
 Constructor declaration.
 ~Brick ()
 Destructor declaration.
void init (int x, int y, int lives)
 Initialise Brick attributes.
void draw (N5110 &lcd)
 Draws the Brick on the LCD, at current coordinates with a fill that is dependant on _lives.
void set_posx (int x)
 Sets the Brick's x coordinate.
void reset_lives (int inc)
 Resets the lives after victory.
bool hit ()
 Decrements the variable _lives.
int get_x ()
 Retrieves the Brick's x coordinate.
int get_y ()
 Retrieves the Brick's y coordinate.

Detailed Description

Brick Class.

Author:
James Heavey, University of Leeds Controls the bricks in the Breakout game
Date:
May 2019

Definition at line 17 of file Brick.h.


Constructor & Destructor Documentation

Brick (  )

Constructor declaration.

Definition at line 3 of file Brick.cpp.

~Brick (  )

Destructor declaration.

Definition at line 8 of file Brick.cpp.


Member Function Documentation

void draw ( N5110 lcd )

Draws the Brick on the LCD, at current coordinates with a fill that is dependant on _lives.

Parameters:
lcda N5110 pointer

Definition at line 25 of file Brick.cpp.

int get_x (  )

Retrieves the Brick's x coordinate.

Returns:
integer _x coordinate

Definition at line 56 of file Brick.cpp.

int get_y (  )

Retrieves the Brick's y coordinate.

Returns:
integer _y coordinate

Definition at line 62 of file Brick.cpp.

bool hit (  )

Decrements the variable _lives.

Returns:
a bool; true if brick is destroyed, false if not

Definition at line 40 of file Brick.cpp.

void init ( int  x,
int  y,
int  lives 
)

Initialise Brick attributes.

Parameters:
xinitialises x coordinate
yinitialises y coordinate
livesinitialises the number of lives

Definition at line 13 of file Brick.cpp.

void reset_lives ( int  inc )

Resets the lives after victory.

Parameters:
incadditional lives added on t o the _base_lives (additional lives come from _multiplier)

Definition at line 51 of file Brick.cpp.

void set_posx ( int  x )

Sets the Brick's x coordinate.

Parameters:
xset the variable _x to the new local x

Definition at line 68 of file Brick.cpp.