Josh Davy / Mbed 2 deprecated Flip

Dependencies:   mbed el17jd

Committer:
joshdavy
Date:
Mon May 06 15:07:28 2019 +0000
Revision:
13:32d580b3935c
Parent:
12:5549a299d41e
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 13:32d580b3935c 16 int index; /**< index of the block that moves in the block array.*/
joshdavy 13:32d580b3935c 17 int distance; /**< Distance the block moves*/
joshdavy 9:96969b1c6bde 18
joshdavy 13:32d580b3935c 19 int initial_pos; /**< Inital x coord of the block*/
joshdavy 13:32d580b3935c 20 bool extending; /**< True if the block is currently in its extending phase
joshdavy 13:32d580b3935c 21 false if retracting.*/
joshdavy 9:96969b1c6bde 22
joshdavy 8:21b6d4dbce44 23 };
joshdavy 8:21b6d4dbce44 24
joshdavy 12:5549a299d41e 25 /** Level Class
joshdavy 8:21b6d4dbce44 26
joshdavy 12:5549a299d41e 27 @brief Class responsible for the handling of levels loading them updating
joshdavy 12:5549a299d41e 28 their state and rendering them.
joshdavy 12:5549a299d41e 29 Levels represent each stage of the game including the player initial location
joshdavy 12:5549a299d41e 30 the goal location and the location of blocks and moving blocks.
joshdavy 12:5549a299d41e 31 @version 1.0
joshdavy 6:2ca1516ec1e2 32
joshdavy 12:5549a299d41e 33 @author Joshua Davy el17jd
joshdavy 12:5549a299d41e 34
joshdavy 12:5549a299d41e 35 @date April 2019
joshdavy 12:5549a299d41e 36
joshdavy 12:5549a299d41e 37 */
joshdavy 6:2ca1516ec1e2 38
joshdavy 6:2ca1516ec1e2 39 class Level {
joshdavy 6:2ca1516ec1e2 40
joshdavy 6:2ca1516ec1e2 41 public:
joshdavy 6:2ca1516ec1e2 42 Level();
joshdavy 6:2ca1516ec1e2 43 ~Level();
joshdavy 9:96969b1c6bde 44 void init(Block blocks [],
joshdavy 8:21b6d4dbce44 45 int number_of_blocks,
joshdavy 11:db27d3838514 46 Vector2D goal,
joshdavy 11:db27d3838514 47 MovingBlockDefinition moving_blocks[],
joshdavy 11:db27d3838514 48 int number_of_moving_blocks);
joshdavy 9:96969b1c6bde 49 void update_moving_blocks();
joshdavy 6:2ca1516ec1e2 50 void render(N5110 &lcd);
joshdavy 13:32d580b3935c 51
joshdavy 9:96969b1c6bde 52 Block * get_blocks();
joshdavy 9:96969b1c6bde 53 int get_number_of_blocks();
joshdavy 9:96969b1c6bde 54 Vector2D get_goal();
joshdavy 6:2ca1516ec1e2 55
joshdavy 6:2ca1516ec1e2 56
joshdavy 6:2ca1516ec1e2 57
joshdavy 6:2ca1516ec1e2 58 private:
joshdavy 13:32d580b3935c 59 void declare_moving_block(int index,bool extending,int distance);
joshdavy 13:32d580b3935c 60
joshdavy 8:21b6d4dbce44 61 Block _blocks [20] ;
joshdavy 6:2ca1516ec1e2 62 int _number_of_blocks;
joshdavy 8:21b6d4dbce44 63 int _number_of_moving_blocks;
joshdavy 8:21b6d4dbce44 64 Vector2D _goal;
joshdavy 8:21b6d4dbce44 65 MovingBlock _moving_blocks [10];
joshdavy 6:2ca1516ec1e2 66 };
joshdavy 6:2ca1516ec1e2 67
joshdavy 6:2ca1516ec1e2 68 #endif