Kostadin Chakarov / Mbed 2 deprecated el17kec

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Map Class Reference

Map Class Reference

Map Class , Creates the map and controls collision between objects in the Breakout game. More...

#include <Map.h>

Public Member Functions

 Map ()
 Stores the powerups in a vector.
 ~Map ()
 Destructor.
int getCurrentLevel ()
 Gets the current level.
bool hasWon ()
 Checks if all levels are defeated.
void initBricks ()
 Get the level object based on the current level number and call initBricks() on it.
void update ()
 Updates the moving powerups on map.
void onBrickHit (const Brick &)
 Creates powerUps depending on the PowerUpDropChancePct.
void drawMap (N5110 &lcd)
 Draws all the bricks on the level, as well as powerUps.
void checkCollision (Ball &ball, Paddle &paddle)
 Checks if brick <-> ball collided.
void resolveCollision (const Brick &brick, GameObject &obj)
 Resolves the collision.
bool checkLevel ()
 Checks if we cleared the level and if we won.
void reset ()
 Resets the whole map when game is (re-)started.
void addBrick (Brick &brick)
 Adds the brick to the vector.

Data Fields

int score
 Stores the score of the game.

Detailed Description

Map Class , Creates the map and controls collision between objects in the Breakout game.

Author:
Kostadin Chakarov, University of Leeds
Date:
April 2019

Definition at line 162 of file Map.h.


Constructor & Destructor Documentation

Map (  )

Stores the powerups in a vector.

Constructor

Definition at line 161 of file Map.cpp.

~Map (  )

Destructor.

Definition at line 171 of file Map.cpp.


Member Function Documentation

void addBrick ( Brick brick )

Adds the brick to the vector.

Definition at line 202 of file Map.h.

void checkCollision ( Ball ball,
Paddle paddle 
)

Checks if brick <-> ball collided.

Definition at line 274 of file Map.cpp.

bool checkLevel (  )

Checks if we cleared the level and if we won.

Returns:
true if level is cleared

Definition at line 341 of file Map.cpp.

void drawMap ( N5110 lcd )

Draws all the bricks on the level, as well as powerUps.

Definition at line 184 of file Map.cpp.

int getCurrentLevel (  )

Gets the current level.

Returns:
the number of the current level

Definition at line 178 of file Map.h.

bool hasWon (  )

Checks if all levels are defeated.

Returns:
true if current level == number of levels

Definition at line 182 of file Map.h.

void initBricks (  )

Get the level object based on the current level number and call initBricks() on it.

Definition at line 176 of file Map.cpp.

void onBrickHit ( const Brick brick )

Creates powerUps depending on the PowerUpDropChancePct.

Definition at line 317 of file Map.cpp.

void reset (  )

Resets the whole map when game is (re-)started.

Definition at line 356 of file Map.cpp.

void resolveCollision ( const Brick brick,
GameObject obj 
)

Resolves the collision.

Definition at line 227 of file Map.cpp.

void update (  )

Updates the moving powerups on map.

Definition at line 335 of file Map.cpp.


Field Documentation

int score

Stores the score of the game.

Definition at line 204 of file Map.h.