![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
test avoid bulled game
Dependencies: C12832_lcd LCD_fonts mbed mbed-rtos
models.h@21:1911f2c4684b, 2016-12-12 (annotated)
- Committer:
- th_mbed
- Date:
- Mon Dec 12 08:58:36 2016 +0000
- Revision:
- 21:1911f2c4684b
- Parent:
- 15:400760117d9d
- Child:
- 23:33d7efd62537
change Stage.; return int[LCD_X] which represents height each dot
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kaku_jyoko | 4:0fe59e58def9 | 1 | #include "point.h" |
th_mbed | 2:50a76ed8bf55 | 2 | #ifndef models_h |
th_mbed | 2:50a76ed8bf55 | 3 | #define models_h |
th_mbed | 2:50a76ed8bf55 | 4 | |
th_mbed | 12:c74115744b24 | 5 | //LCD params |
th_mbed | 12:c74115744b24 | 6 | #define LCD_X 128 |
th_mbed | 12:c74115744b24 | 7 | #define LCD_Y 32 |
th_mbed | 12:c74115744b24 | 8 | |
th_mbed | 12:c74115744b24 | 9 | //Stage params |
th_mbed | 21:1911f2c4684b | 10 | #define ONE_STEP_SIZE 10 |
th_mbed | 15:400760117d9d | 11 | //#define STEP_NUM LCD_X/ONE_STEP_SIZE+1 |
th_mbed | 15:400760117d9d | 12 | #define ALL_LENGTH 1000 //stage all length |
th_mbed | 12:c74115744b24 | 13 | #define STAGE_V 1 |
th_mbed | 12:c74115744b24 | 14 | |
th_mbed | 9:a2195ad200fa | 15 | //Person params |
th_mbed | 12:c74115744b24 | 16 | #define PERSON_SIZE 6 //person is 6 * 6 dots |
th_mbed | 2:50a76ed8bf55 | 17 | #define DEFAULT_X 2 |
th_mbed | 8:2fd3eedcde64 | 18 | #define DEFAULT_Y 25 //31-7+1 |
kaku_jyoko | 7:defdc7cb4e0b | 19 | #define MAX_JUMP_TIME 7 |
th_mbed | 2:50a76ed8bf55 | 20 | #define MAX_JUMP_COUNT 2 |
th_mbed | 8:2fd3eedcde64 | 21 | #define JUMP_SIZE 2 |
th_mbed | 8:2fd3eedcde64 | 22 | #define GAME_OVER -1 |
th_mbed | 2:50a76ed8bf55 | 23 | |
th_mbed | 9:a2195ad200fa | 24 | //Bullet params |
th_mbed | 9:a2195ad200fa | 25 | #define HIGH_SPEED 5 |
th_mbed | 9:a2195ad200fa | 26 | #define NOMAL_SOEED 3 |
th_mbed | 9:a2195ad200fa | 27 | #define LOW_SPEED 1 |
th_mbed | 9:a2195ad200fa | 28 | |
th_mbed | 2:50a76ed8bf55 | 29 | class Person |
th_mbed | 2:50a76ed8bf55 | 30 | { |
th_mbed | 2:50a76ed8bf55 | 31 | private: |
th_mbed | 2:50a76ed8bf55 | 32 | point p; |
th_mbed | 2:50a76ed8bf55 | 33 | int jump_count; |
th_mbed | 2:50a76ed8bf55 | 34 | int jump_time; |
th_mbed | 8:2fd3eedcde64 | 35 | bool isGround(int height); |
th_mbed | 2:50a76ed8bf55 | 36 | |
th_mbed | 2:50a76ed8bf55 | 37 | public: |
th_mbed | 2:50a76ed8bf55 | 38 | Person(); |
th_mbed | 8:2fd3eedcde64 | 39 | point update(int height); |
th_mbed | 2:50a76ed8bf55 | 40 | point jump(); |
th_mbed | 2:50a76ed8bf55 | 41 | }; |
th_mbed | 2:50a76ed8bf55 | 42 | |
th_mbed | 2:50a76ed8bf55 | 43 | class Bullet |
th_mbed | 2:50a76ed8bf55 | 44 | { |
th_mbed | 2:50a76ed8bf55 | 45 | private: |
th_mbed | 2:50a76ed8bf55 | 46 | point p; |
th_mbed | 2:50a76ed8bf55 | 47 | int v; |
th_mbed | 2:50a76ed8bf55 | 48 | public: |
th_mbed | 2:50a76ed8bf55 | 49 | Bullet(point p, int v); |
th_mbed | 2:50a76ed8bf55 | 50 | point update(); |
th_mbed | 2:50a76ed8bf55 | 51 | }; |
th_mbed | 2:50a76ed8bf55 | 52 | |
th_mbed | 12:c74115744b24 | 53 | class Stage |
th_mbed | 12:c74115744b24 | 54 | { |
th_mbed | 12:c74115744b24 | 55 | private: |
th_mbed | 12:c74115744b24 | 56 | int length; |
th_mbed | 21:1911f2c4684b | 57 | int stage[LCD_X]; |
th_mbed | 12:c74115744b24 | 58 | public: |
th_mbed | 21:1911f2c4684b | 59 | Stage(); |
th_mbed | 21:1911f2c4684b | 60 | int* getStage(); |
th_mbed | 21:1911f2c4684b | 61 | int getLength(); |
th_mbed | 12:c74115744b24 | 62 | }; |
th_mbed | 12:c74115744b24 | 63 | |
th_mbed | 2:50a76ed8bf55 | 64 | #endif |