test avoid bulled game
Dependencies: C12832_lcd LCD_fonts mbed mbed-rtos
Diff: main.cpp
- Revision:
- 38:63b99151e218
- Parent:
- 36:b88fa8ff0be9
- Parent:
- 37:f5d98f22b6bd
- Child:
- 39:e8d6dd3c75c7
diff -r b88fa8ff0be9 -r 63b99151e218 main.cpp --- a/main.cpp Mon Dec 12 12:47:07 2016 +0000 +++ b/main.cpp Tue Dec 13 07:34:07 2016 +0000 @@ -38,10 +38,10 @@ void make_wall(){ wall_height = stage.getStage(); - for(int i = 0; i < LCD_X; i++){ - for(int j = LCD_Y - 1; j >= 0; j--){ - if(LCD_Y - 1 - wall_height[i] <= j){ - white_board[j][i] = white_board[j][i] = 1; + for(int i = 0; i < LCD_Y; i++){ + for(int j = 0; j < LCD_X ; j++){ + if(wall_height[i] > (LCD_Y - 1 - j)){ + white_board[i][j] = 1; } } } @@ -103,7 +103,13 @@ lcd.setmode(XOR); int gameOver = 0; srand((int)(aIn * 100)); +<<<<<<< local Converter converter; +======= + Converter converter(); + int len = LCD_Y*LCD_X/8; + char char_map[len]; +>>>>>>> other // Bitmap picture; while(true){ @@ -117,10 +123,16 @@ //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); corrision_judge(p_person, p_bullet); - Bitmap picture = converter.convert(white_board); + Bitmap bitmap_converted = { + LCD_X, + LCD_Y, + LCD_X/8, + char_map, + }; update_mtx.unlock(); lcd.cls(); lcd.print_bm(bitmPlayer,p_person.x,p_person.y); + lcd.print_bm(bitmap_converted,0,0); if(b != NULL){ lcd.print_bm(bitmBullet_graphics, p_bullet.x, p_bullet.y); } @@ -128,6 +140,7 @@ wait(0.02); lcd.cls(); lcd.print_bm(bitmPlayerB,p_person.x,p_person.y); + lcd.print_bm(bitmap_converted,0,0); if(b != NULL){ lcd.print_bm(bitmBullet_graphics, p_bullet.x, p_bullet.y); }