![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
test avoid bulled game
Dependencies: C12832_lcd LCD_fonts mbed mbed-rtos
Person.cpp
- Committer:
- kaku_jyoko
- Date:
- 2016-12-02
- Revision:
- 6:e63641e13374
- Parent:
- 4:0fe59e58def9
- Child:
- 7:defdc7cb4e0b
File content as of revision 6:e63641e13374:
#include "point.h" #include "models.h" Person::Person(){ p.x = DEFAULT_X; p.y = DEFAULT_Y; jump_count = 0; jump_time = 0; } point Person::update(){ if(jump_time == 0){ //not jump return p; }else if(jump_time == MAX_JUMP_TIME){ //down p.y += 1; }else{ //up jump_time++; p.y--; } return p; } point Person::ground(){ jump_count = 0; jump_time = 0; return p; } point Person::jump(){ if(jump_count < MAX_JUMP_COUNT){ p.y--; jump_time = 1; jump_count++; } return p; }