Dependencies: C12832 MMA7660 mbed
Fork of shot_game by
Diff: main.cpp
- Revision:
- 1:880253791d78
- Parent:
- 0:6ab01cb28fd0
diff -r 6ab01cb28fd0 -r 880253791d78 main.cpp --- a/main.cpp Wed Apr 15 08:22:43 2015 +0000 +++ b/main.cpp Thu Apr 16 06:19:56 2015 +0000 @@ -35,7 +35,20 @@ r = g = b = 1; lcd.cls(); lcd.locate(0, 0); - lcd.printf("SCORE:%d", score); + lcd.printf("SCORE:%d ", score); + fp = fopen("local/test.txt","r"); + fscanf(fp,"%d",i); + fclose(fp); + if(score > i){ + fp = fopen("local/test.txt","w"); + fprintf(fp,"%d",score); + fclose(fp); + lcd.printf("NEW RECORD!!\n"); + lcd.printf("HIGH SCORE:%d",score); + } + else{ + lcd.printf("HIGH SCORE:%d",i); + } wait(2); speaker = 0; while(1);