![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
test avoid bulled game
Dependencies: C12832_lcd LCD_fonts mbed mbed-rtos
models.h@12:c74115744b24, 2016-12-05 (annotated)
- Committer:
- th_mbed
- Date:
- Mon Dec 05 12:01:14 2016 +0000
- Revision:
- 12:c74115744b24
- Parent:
- 9:a2195ad200fa
- Child:
- 13:70e31c1d8205
modify Person and add Stage.; But Stage always returns all 1 height stage.
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 | 12:c74115744b24 | 10 | #define ONE_STEP_SIZE 15 |
th_mbed | 12:c74115744b24 | 11 | #define STEP_NUM LCD_X/ONE_STSGE_SIZE+1 |
th_mbed | 12:c74115744b24 | 12 | #define ALL_LENGTH 1000 |
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 v; |
th_mbed | 12:c74115744b24 | 57 | int length; |
th_mbed | 12:c74115744b24 | 58 | point[STEP_NUM] stage; |
th_mbed | 12:c74115744b24 | 59 | public: |
th_mbed | 12:c74115744b24 | 60 | Stage(int v); |
th_mbed | 12:c74115744b24 | 61 | point* getStage(point* stage); |
th_mbed | 12:c74115744b24 | 62 | }; |
th_mbed | 12:c74115744b24 | 63 | |
th_mbed | 12:c74115744b24 | 64 | |
th_mbed | 2:50a76ed8bf55 | 65 | #endif |