diff --git a/Final_Project_Slither_lite_allegro.depend b/Final_Project_Slither_lite_allegro.depend index 513ff7d..ae695ac 100644 --- a/Final_Project_Slither_lite_allegro.depend +++ b/Final_Project_Slither_lite_allegro.depend @@ -311,7 +311,7 @@ 1483943908 source:d:\codeblocks_hw\final_project_slither_lite_allegro\src\lightspot.c "Lightspot.h" -1484448990 source:d:\codeblocks_hw\final_project_slither_lite_allegro\src\main.c +1484489021 source:d:\codeblocks_hw\final_project_slither_lite_allegro\src\main.c diff --git a/Final_Project_Slither_lite_allegro.layout b/Final_Project_Slither_lite_allegro.layout index 71b03e4..d6dc9c9 100644 --- a/Final_Project_Slither_lite_allegro.layout +++ b/Final_Project_Slither_lite_allegro.layout @@ -2,24 +2,24 @@ - + - + - + - + - + - + - + - + @@ -27,14 +27,14 @@ - + - + - + - + @@ -42,9 +42,9 @@ - + - + diff --git a/Setup.iss b/Setup.iss index 4628327..8d4c86f 100644 --- a/Setup.iss +++ b/Setup.iss @@ -17,7 +17,7 @@ DefaultDirName={userdesktop}\Slither_Lite DisableProgramGroupPage=yes InfoBeforeFile=D:\CodeBlocks_HW\Final_Project_Slither_lite_allegro\CopyRight.md LicenseFile=D:\CodeBlocks_HW\Final_Project_Slither_lite_allegro\同意條款.txt -OutputBaseFilename=setup +OutputBaseFilename=貪吃蛇的危機_Setup SetupIconFile=D:\CodeBlocks_HW\Final_Project_Slither_lite_allegro\assets\icon.ico SolidCompression=yes Uninstallable=yes diff --git a/assets/data.bin b/assets/data.bin deleted file mode 100644 index 3d65907..0000000 Binary files a/assets/data.bin and /dev/null differ diff --git a/src/main.c b/src/main.c index 2c8e3a5..d6ad087 100644 --- a/src/main.c +++ b/src/main.c @@ -295,6 +295,8 @@ int mainGameLoop(char* name,int Ainumbers,int lightspot,void (*aiExec)(Snake** s /**< 殺蛇幾隻 一隻加1000分 */ int killCount = 0; + int remainSnakes = 0; + al_flush_event_queue(Res.eventQueue); @@ -381,15 +383,21 @@ int mainGameLoop(char* name,int Ainumbers,int lightspot,void (*aiExec)(Snake** s oldFPS = FPS; FPS = 0; mapUpdateLightSpotData(map); + int k; + remainSnakes = 0; + for(k=1; kisDead))remainSnakes++; + } } - if(al_is_event_queue_empty(Res.eventQueue)&&FPS>59) { + if(al_is_event_queue_empty(Res.eventQueue)&&oldFPS>59) { //*< 死掉會復活 */ - if(event.timer.count%6==0) { + int k=50; + while(k--){ Snake_rebirth(snakes,Ainumbers); } //*< 有機率增加亮點 */ - if(rand()%100 < 10) { + if(rand()%100 < 30) { Put_LightSpot(map,Create_LightSpot(map->size)); } } @@ -476,8 +484,8 @@ int mainGameLoop(char* name,int Ainumbers,int lightspot,void (*aiExec)(Snake** s Draw_Snake(snakes[i],Res.snake_body,Res.snake_head,Res.display,snakes[keyIn_int]->head->current_position); } al_draw_textf(Res.builtinFont,al_map_rgb(255,0,0),0,al_get_display_height(Res.display)-8,0, - "FPS:%d Pos(%.0f,%.0f) Length:%d Lsp:%d LspSize:%d", - oldFPS,snake->head->current_position.x,snake->head->current_position.y,snake->length,map->totalLightSpotLength,map->totalLightSpotSize); + "FPS:%d Pos(%.0f,%.0f) Length:%d Lsp:%d LspSize:%d remainSnake:%d", + oldFPS,snake->head->current_position.x,snake->head->current_position.y,snake->length,map->totalLightSpotLength,map->totalLightSpotSize,remainSnakes); al_draw_textf(Res.builtinFont,al_map_rgb(255,0,0),al_get_display_width(Res.display)-80,al_get_display_height(Res.display)-8,0, "snakes:%d",keyIn_int); if(userControl) { @@ -675,7 +683,7 @@ int selectLevel(int levelNum) { button[i].startY=frameH*((i/maxLevelRow)+1.0/4); } screenNeedRefresh=1; - }else if(event.keyboard.keycode==ALLEGRO_KEY_F12) { + } else if(event.keyboard.keycode==ALLEGRO_KEY_F12) { /**< Screen shot */ ALLEGRO_BITMAP* screenshot = al_create_bitmap(al_get_display_width(Res.display),al_get_display_height(Res.display)); al_set_target_bitmap(screenshot);