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