Mochu Yao explorer game
Dependencies: mbed
line/surface.h@7:88c4ba6bb37b, 2020-04-23 (annotated)
- Committer:
- el17my
- Date:
- Thu Apr 23 07:49:39 2020 +0000
- Revision:
- 7:88c4ba6bb37b
start to creat game enginee
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el17my | 7:88c4ba6bb37b | 1 | /** surface |
el17my | 7:88c4ba6bb37b | 2 | * @the surface file has three functions |
el17my | 7:88c4ba6bb37b | 3 | //1 the leftside of the line move toward right then the rightside should also move to the right to keep the length |
el17my | 7:88c4ba6bb37b | 4 | //2 the line will be random length but must be suitable |
el17my | 7:88c4ba6bb37b | 5 | //3 makesure there are two surface for player to stay |
el17my | 7:88c4ba6bb37b | 6 | * @date April 22th 2020 |
el17my | 7:88c4ba6bb37b | 7 | * @author Yaomochu |
el17my | 7:88c4ba6bb37b | 8 | */ |
el17my | 7:88c4ba6bb37b | 9 | #ifndef LINE_H |
el17my | 7:88c4ba6bb37b | 10 | #define LINE_H |
el17my | 7:88c4ba6bb37b | 11 | |
el17my | 7:88c4ba6bb37b | 12 | #include "mbed.h" |
el17my | 7:88c4ba6bb37b | 13 | //the surface function is to creat the surface for player to stand on and move |
el17my | 7:88c4ba6bb37b | 14 | struct Line { |
el17my | 7:88c4ba6bb37b | 15 | int length; |
el17my | 7:88c4ba6bb37b | 16 | int left; |
el17my | 7:88c4ba6bb37b | 17 | int right; |
el17my | 7:88c4ba6bb37b | 18 | int y; |
el17my | 7:88c4ba6bb37b | 19 | }; |
el17my | 7:88c4ba6bb37b | 20 | //the line structer will have four main elements |
el17my | 7:88c4ba6bb37b | 21 | class Surface |
el17my | 7:88c4ba6bb37b | 22 | { |
el17my | 7:88c4ba6bb37b | 23 | public: |
el17my | 7:88c4ba6bb37b | 24 | Surface(); |
el17my | 7:88c4ba6bb37b | 25 | ~Surface(); |
el17my | 7:88c4ba6bb37b | 26 | void init(int left, int right, int y1, int y2); |
el17my | 7:88c4ba6bb37b | 27 | //init the line at first to set the initial position |
el17my | 7:88c4ba6bb37b | 28 | void line_1(); |
el17my | 7:88c4ba6bb37b | 29 | void line_2(); |
el17my | 7:88c4ba6bb37b | 30 | void line_3(); |
el17my | 7:88c4ba6bb37b | 31 | void line_4(); |
el17my | 7:88c4ba6bb37b | 32 | void line_5(); |
el17my | 7:88c4ba6bb37b | 33 | void line_6(); |
el17my | 7:88c4ba6bb37b | 34 | void getline_1(); |
el17my | 7:88c4ba6bb37b | 35 | void getline_2(); |
el17my | 7:88c4ba6bb37b | 36 | void getline_3(); |
el17my | 7:88c4ba6bb37b | 37 | void getline_4(); |
el17my | 7:88c4ba6bb37b | 38 | void getline_5(); |
el17my | 7:88c4ba6bb37b | 39 | void getline_6(); |
el17my | 7:88c4ba6bb37b | 40 | |
el17my | 7:88c4ba6bb37b | 41 | private: |
el17my | 7:88c4ba6bb37b | 42 | Line _line_1; |
el17my | 7:88c4ba6bb37b | 43 | Line _line_2; |
el17my | 7:88c4ba6bb37b | 44 | Line _line_3; |
el17my | 7:88c4ba6bb37b | 45 | Line _line_4; |
el17my | 7:88c4ba6bb37b | 46 | Line _line_5; |
el17my | 7:88c4ba6bb37b | 47 | Line _line_6; |
el17my | 7:88c4ba6bb37b | 48 | |
el17my | 7:88c4ba6bb37b | 49 | }; |
el17my | 7:88c4ba6bb37b | 50 | #endif |
el17my | 7:88c4ba6bb37b | 51 |