Josh Davy / Mbed 2 deprecated Flip

Dependencies:   mbed el17jd

Committer:
joshdavy
Date:
Mon May 06 14:52:05 2019 +0000
Revision:
12:5549a299d41e
Parent:
11:db27d3838514
Child:
13:32d580b3935c
test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
joshdavy 6:2ca1516ec1e2 1 #ifndef LEVEL_H
joshdavy 6:2ca1516ec1e2 2 #define LEVEL_H
joshdavy 6:2ca1516ec1e2 3
joshdavy 11:db27d3838514 4
joshdavy 6:2ca1516ec1e2 5 #include "mbed.h"
joshdavy 6:2ca1516ec1e2 6 #include "N5110.h"
joshdavy 6:2ca1516ec1e2 7 #include "Gamepad.h"
joshdavy 6:2ca1516ec1e2 8 #include "Bitmap.h"
joshdavy 11:db27d3838514 9 #include "LevelDefinitions.h"
joshdavy 12:5549a299d41e 10 #include "GoalSprite.h"
joshdavy 7:68e06dda79f7 11
joshdavy 12:5549a299d41e 12 /**
joshdavy 12:5549a299d41e 13 * @brief Struct for storing the current location/state of any moving blocks
joshdavy 12:5549a299d41e 14 */
joshdavy 8:21b6d4dbce44 15 struct MovingBlock {
joshdavy 9:96969b1c6bde 16 int index;
joshdavy 9:96969b1c6bde 17 int distance;
joshdavy 9:96969b1c6bde 18
joshdavy 9:96969b1c6bde 19 int initial_pos;
joshdavy 9:96969b1c6bde 20 bool extending;
joshdavy 9:96969b1c6bde 21
joshdavy 8:21b6d4dbce44 22 };
joshdavy 8:21b6d4dbce44 23
joshdavy 12:5549a299d41e 24 /** Level Class
joshdavy 8:21b6d4dbce44 25
joshdavy 12:5549a299d41e 26 @brief Class responsible for the handling of levels loading them updating
joshdavy 12:5549a299d41e 27 their state and rendering them.
joshdavy 12:5549a299d41e 28 Levels represent each stage of the game including the player initial location
joshdavy 12:5549a299d41e 29 the goal location and the location of blocks and moving blocks.
joshdavy 12:5549a299d41e 30 @version 1.0
joshdavy 6:2ca1516ec1e2 31
joshdavy 12:5549a299d41e 32 @author Joshua Davy el17jd
joshdavy 12:5549a299d41e 33
joshdavy 12:5549a299d41e 34 @date April 2019
joshdavy 12:5549a299d41e 35
joshdavy 12:5549a299d41e 36 */
joshdavy 6:2ca1516ec1e2 37
joshdavy 6:2ca1516ec1e2 38 class Level {
joshdavy 6:2ca1516ec1e2 39
joshdavy 6:2ca1516ec1e2 40 public:
joshdavy 6:2ca1516ec1e2 41 Level();
joshdavy 6:2ca1516ec1e2 42 ~Level();
joshdavy 9:96969b1c6bde 43 void init(Block blocks [],
joshdavy 8:21b6d4dbce44 44 int number_of_blocks,
joshdavy 11:db27d3838514 45 Vector2D goal,
joshdavy 11:db27d3838514 46 MovingBlockDefinition moving_blocks[],
joshdavy 11:db27d3838514 47 int number_of_moving_blocks);
joshdavy 9:96969b1c6bde 48 void update_moving_blocks();
joshdavy 6:2ca1516ec1e2 49 void render(N5110 &lcd);
joshdavy 9:96969b1c6bde 50 void declare_moving_block(int index,bool extending,int distance);
joshdavy 9:96969b1c6bde 51 Block * get_blocks();
joshdavy 9:96969b1c6bde 52 int get_number_of_blocks();
joshdavy 9:96969b1c6bde 53 Vector2D get_goal();
joshdavy 6:2ca1516ec1e2 54
joshdavy 6:2ca1516ec1e2 55
joshdavy 6:2ca1516ec1e2 56
joshdavy 6:2ca1516ec1e2 57 private:
joshdavy 8:21b6d4dbce44 58 Block _blocks [20] ;
joshdavy 6:2ca1516ec1e2 59 int _number_of_blocks;
joshdavy 8:21b6d4dbce44 60 int _number_of_moving_blocks;
joshdavy 8:21b6d4dbce44 61 Vector2D _goal;
joshdavy 8:21b6d4dbce44 62 MovingBlock _moving_blocks [10];
joshdavy 6:2ca1516ec1e2 63 };
joshdavy 6:2ca1516ec1e2 64
joshdavy 6:2ca1516ec1e2 65 #endif