![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
test avoid bulled game
Dependencies: C12832_lcd LCD_fonts mbed mbed-rtos
Diff: main.cpp
- Revision:
- 45:7d0a58fbaa8b
- Parent:
- 40:ec5c1b305b9a
- Child:
- 47:50c54cb24316
diff -r ec5c1b305b9a -r 7d0a58fbaa8b main.cpp --- a/main.cpp Tue Dec 13 13:32:44 2016 +0000 +++ b/main.cpp Tue Dec 13 13:50:26 2016 +0000 @@ -101,6 +101,15 @@ return false; } +bool wall_collision(point p_person){ + int x = p_person.x + 5; + int y = p_person.y + 6; + if(wall_height[x - 1] > (LCD_Y - y)){ + return true; + } + return false; +} + int main(){ point p_person, p_bullet; printf("hello\n"); @@ -126,6 +135,7 @@ //printf("bullet x: %d, y: %d \n", p_bullet.x,p_bullet.y); //printf("person x: %d, y: %d \n", p_person.x,p_person.y); gameover = bullet_collision(p_person, p_bullet); + gameover = wall_collision(p_person); picture = converter.convert(white_board); update_mtx.unlock();