Mochu Yao explorer game
Dependencies: mbed
item/item.h@3:672d4bd8225d, 2020-04-21 (annotated)
- Committer:
- el17my
- Date:
- Tue Apr 21 12:31:27 2020 +0000
- Revision:
- 3:672d4bd8225d
- Parent:
- 2:89f04cd3bf45
- Child:
- 8:201ef0618b7d
creating the line on the screen
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el17my | 1:ed745421d8c4 | 1 | #ifndef ITEM_H |
el17my | 1:ed745421d8c4 | 2 | #define ITEM_H |
el17my | 1:ed745421d8c4 | 3 | |
el17my | 1:ed745421d8c4 | 4 | #include "mbed.h" |
el17my | 1:ed745421d8c4 | 5 | |
el17my | 3:672d4bd8225d | 6 | //* @the item file has three functions |
el17my | 3:672d4bd8225d | 7 | // 1 generate an item in random position after one disappear |
el17my | 3:672d4bd8225d | 8 | // 2 build the item's structer |
el17my | 3:672d4bd8225d | 9 | // 3 build a barrier to increase difficulty |
el17my | 3:672d4bd8225d | 10 | //* @date April 13th 2020 |
el17my | 3:672d4bd8225d | 11 | //* @author Yaomochu |
el17my | 1:ed745421d8c4 | 12 | |
el17my | 1:ed745421d8c4 | 13 | class item |
el17my | 1:ed745421d8c4 | 14 | { |
el17my | 1:ed745421d8c4 | 15 | public: |
el17my | 1:ed745421d8c4 | 16 | // Constructor and Destructor. |
el17my | 1:ed745421d8c4 | 17 | item(); |
el17my | 1:ed745421d8c4 | 18 | ~item(); |
el17my | 1:ed745421d8c4 | 19 | |
el17my | 2:89f04cd3bf45 | 20 | // Initialises object.*/ |
el17my | 1:ed745421d8c4 | 21 | void init(); |
el17my | 1:ed745421d8c4 | 22 | //Generates the item and barrier. |
el17my | 1:ed745421d8c4 | 23 | void generate_item(); |
el17my | 1:ed745421d8c4 | 24 | //Sets the item coordinates. |
el17my | 1:ed745421d8c4 | 25 | //rand_x = a random number that determines the x coordinate |
el17my | 1:ed745421d8c4 | 26 | //rand_y = a random number that determines if the item's generated level |
el17my | 3:672d4bd8225d | 27 | void set_item(int random_x, int random_y); |
el17my | 3:672d4bd8225d | 28 | int *get_item_form();// rotating |
el17my | 1:ed745421d8c4 | 29 | int get_item_x(); |
el17my | 1:ed745421d8c4 | 30 | int get_item_y(); |
el17my | 1:ed745421d8c4 | 31 | |
el17my | 1:ed745421d8c4 | 32 | |
el17my | 1:ed745421d8c4 | 33 | private: |
el17my | 3:672d4bd8225d | 34 | int _x;//the x coordinate of the item |
el17my | 3:672d4bd8225d | 35 | int _y;//the y coordinate of the item |
el17my | 3:672d4bd8225d | 36 | int _loop;//the loop is used for the item to rotating which means after a few loop it will change it's form |
el17my | 3:672d4bd8225d | 37 | bool _rotate_item;//when the loop reach a certain value the bool situation will determine if it will rotate |
el17my | 1:ed745421d8c4 | 38 | }; |
el17my | 1:ed745421d8c4 | 39 | #endif |