Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Map/Map.h
- Committer:
- evanso
- Date:
- 2020-04-18
- Revision:
- 7:0af4ced868f5
- Parent:
- 6:12e8433382b3
- Child:
- 8:dd1037c5435b
File content as of revision 7:0af4ced868f5:
#ifndef MAP_H
#define MAP_H
// Include libraries
#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
/** Map class
@brief Draws and moves map
@author Benjamin Evans, University of Leeds
@date April 2020
*/
class Map {
public:
/** Constructor */
Map();
/** Destructor */
~Map();
/** Initalises Spaceship */
void init();
/** Draws a triangle from position with specified hight wich represents a mountain of the map
* @param LCD object, Hight of trangle
*/
void draw_triangle(N5110 &lcd, int triangle_hight);
/** Draws a horizontal line with specified length to represent flat land on map
* @param LCD object, Length of line
*/
void draw_line(N5110 &lcd, int line_length);
/** Gets 12 random integers between 5 and 12 for the random heights of triangles
* and stores in an array so same random map is drawn when screen refreshesh
* @return random hieght of the traingle
*/
void get_random_hight_array();
/** Gets 12 random integers between 15 and 30 for the random lengths of lines
* and stores in an array so same random map is drawn when screen refreshesh
* @return random length of lines
*/
void get_random_length_array();
/** Draws map out of combination of random hight traingle and random length lines so map is differnt each new game
* @param LCD object,
*/
void draw_map(N5110 &lcd, int move_map);
int get_position_x_map();
void clear_map(N5110 &lcd);
private:
int position_x_map_;
int position_y_map_;
float rand_seed_;
int rand_hights_[12];
int rand_lengths_[12];
};
#endif