瀏覽代碼

upd slots

MX 1 年之前
父節點
當前提交
ae9996cfaa
共有 2 個文件被更改,包括 11 次插入2 次删除
  1. 3 1
      README.md
  2. 8 1
      slotmachine.c

+ 3 - 1
README.md

@@ -3,4 +3,6 @@
 ![Screen1](screen1.png "Title")
 ![Screen2](screen2.png "Title")
 
-I am not a C programmer, so any suggestions are welcome!
+Simple slots with highscores for flipper zero.
+
+*version 1.0.1*

+ 8 - 1
slotmachine.c

@@ -46,6 +46,7 @@ static SlotsHighscore highscore;
 
 static bool highscores_load() {
     Storage* storage = furi_record_open(RECORD_STORAGE);
+    storage_common_migrate(storage, EXT_PATH("apps/Games/slotmachine.save"), HIGHSCORES_FILENAME);
     File* file = storage_file_alloc(storage);
 
     uint16_t bytes_readed = 0;
@@ -88,10 +89,16 @@ void game_results(SlotMachineApp* app) {
     }
 
     if(total > 0) {
-        app->money += total;
+        app->money += total; // Add winnings to the player's money
         app->winamount = total;
         app->winview = true;
 
+        // Add the bet amount back to the player's money
+        app->money += app->bet;
+
+        // Reset the bet amount, uncomment me if you want to do this
+        //app->bet = 0;
+
         if(total > highscore.highscore) {
             highscore.highscore = total;
             highscores_save();