diff options
| author | 1029chris <1029chris@gmail.com> | 2017-02-14 16:17:55 -0800 |
|---|---|---|
| committer | 1029chris <1029chris@gmail.com> | 2017-02-14 16:17:55 -0800 |
| commit | 5daf2309272fc3d413f230514534d550c6bd2e33 (patch) | |
| tree | b01c942a50a590aa6a4b20c1ad223cd3b6b7ef00 /loading.lua | |
| parent | dcf61eedc3f19af5a98ffd78439306ffe205ad77 (diff) | |
Made save game better
The game auto saves when you lose as well.
Diffstat (limited to 'loading.lua')
| -rw-r--r-- | loading.lua | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/loading.lua b/loading.lua index 49af6bd..26657c2 100644 --- a/loading.lua +++ b/loading.lua @@ -47,9 +47,15 @@ function drawPause() love.graphics.setBackgroundColor(0, 128, 128) end end +function saveGameFile() + love.filesystem.write("savegame.txt","v1.complete = ".. bool2str(v1.complete) ..";virus1Lose = " .. virus1Lose .. ";v2.complete = ".. bool2str(v2.complete) ..";virus2Lose = " .. virus2Lose .. ";") +end +function resetGameFile() + love.filesystem.write("savegame.txt","v1.complete = false;virus1Lose = 0;v2.complete = false;virus2Lose = 0;") +end function loadSave() if love.filesystem.exists("savegame.txt") == false then - love.filesystem.write("savegame.txt", "") + saveGameFile() else loadGame = love.filesystem.load("savegame.txt") loadGame() @@ -60,3 +66,10 @@ function loadSave() profile.setup = true end end +function bool2str(bool) + if bool == false then + return "false" + else + return "true" + end +end |
