diff options
| -rw-r--r-- | assets.lua | 1 | ||||
| -rw-r--r-- | conf.lua | 3 | ||||
| -rw-r--r-- | loading.lua | 13 | ||||
| -rw-r--r-- | settings.lua | 27 | ||||
| -rw-r--r-- | var.lua | 7 | ||||
| -rw-r--r-- | virus1.lua | 1 | ||||
| -rw-r--r-- | virus2.lua | 2 |
7 files changed, 51 insertions, 3 deletions
@@ -304,6 +304,7 @@ function loadAssets(id) ]] end if id == 17 then + loadSave() loadDia() end if id == 18 then @@ -1,5 +1,6 @@ function love.conf(t) - t.version = "0.10.0" + t.version = "0.10.2" + t.identity = "DontGetAVirus" t.modules.joystick = false t.window.title = "Don't Get a Virus" t.window.fullscreentype = "desktop" diff --git a/loading.lua b/loading.lua index db36706..49af6bd 100644 --- a/loading.lua +++ b/loading.lua @@ -47,3 +47,16 @@ function drawPause() love.graphics.setBackgroundColor(0, 128, 128) end end +function loadSave() + if love.filesystem.exists("savegame.txt") == false then + love.filesystem.write("savegame.txt", "") + else + loadGame = love.filesystem.load("savegame.txt") + loadGame() + end + if love.filesystem.exists("profile.txt") == true then + loadProfile = love.filesystem.load("profile.txt") + loadProfile() + profile.setup = true + end +end diff --git a/settings.lua b/settings.lua index 5d5a603..cdb0484 100644 --- a/settings.lua +++ b/settings.lua @@ -49,9 +49,9 @@ function drawSettings() drawDownBox(8, 305, 384/2-4, 25, 2) love.graphics.setColor(colors.font.dark) love.graphics.print("Difficulty", 14, 313) - drawDownBox(8, 340, 384/2-4, 198, 2) + drawDownBox(8, 340, 384/2-4, 122, 2) love.graphics.setColor(255,255,255) - love.graphics.rectangle("fill", 9, 341, 384/2-6, 196) + love.graphics.rectangle("fill", 9, 341, 384/2-6, 120) for i=1,6 do drawDiSel(i) end @@ -64,6 +64,13 @@ function drawSettings() for i=1,#stre do drawReSel(i) end + drawUpBox(8, 467, 384/2-4, 23, 2) + drawUpBox(8, 492, 384/2-4, 23, 2) + drawUpBox(8, 517, 384/2-4, 23, 2) + love.graphics.setColor(colors.font.dark) + love.graphics.print("Erase Save File", 14, 475) + love.graphics.print("Erase Profile", 14, 500) + love.graphics.print("Erase Both", 14, 525) end function stencilBg() love.graphics.rectangle("fill", 88-64, 44+32, 152, 120) @@ -102,6 +109,22 @@ function drawReSel(i) end end function updateSettings() + if mouseClick(win[6].x+8, win[6].y+467, 384/2-4, 23) == true and layer[1] == 6 then + love.audio.stop() + love.filesystem.remove("savefile.txt") + loadRe() + end + if mouseClick(win[6].x+8, win[6].y+492, 384/2-4, 23) == true and layer[1] == 6 then + love.audio.stop() + love.filesystem.remove("profile.txt") + loadRe() + end + if mouseClick(win[6].x+8, win[6].y+517, 384/2-4, 23) == true and layer[1] == 6 then + love.audio.stop() + love.filesystem.remove("savefile.txt") + love.filesystem.remove("profile.txt") + loadRe() + end for i=1,6 do if (layer[1] == 6 and win[6].hover == true and sys.mouse.p.p == true and sys.mouse.drag == false and sys.mouse.p.x >= win[6].x+263 and sys.mouse.p.x <= win[6].x+263+120 and @@ -62,6 +62,7 @@ function loadVar() loadWin(8, 400, 300, "Video Player", nil, icons[16].video) loadWin(9, 250, 150, "Music Player", nil, icons[16].music) loadWin(10, 350, 500, "Document Viewer", nil, icons[16].document) + loadWin(11, 400, 600, "First Time Setup", nil, icons[16].help) win[4].crazy = false win[4].crazyLeft = false win[4].crazyUp = false @@ -134,6 +135,11 @@ function loadVar() internet.load = 0 internet.blinkTimer = 0 internet.blink = false + profile = {} + profile.setup = false + profile.name = "No Name" + profile.gender = "Person" + profile.pronoun = {they,them,their} v1.yes = false v1.timer = 0 v1.shakemin = 0 @@ -451,6 +457,7 @@ function loadRe() v1.turret[4] = {r=math.rad(-30),x=0,y=0,rt=math.rad(-30),t=0,tl=4} expl.frame = 1 loadVar() + loadSave() loadDia() scene = 0 end @@ -543,6 +543,7 @@ function drawVirusFight1() if v1.explodeEndFrame >= 20 then v1.yes = false if v1.c.chat.msgs == 47 then + love.filesystem.write("savegame.txt", "v1.complete = true;virus1Lose = " .. virus1Lose .. ";") win[4].w = 200 antivirus.status = "Virus Defeated" win[4].update = true @@ -322,6 +322,8 @@ function drawVirusFight2() if v1.explodeEndFrame >= 20 then v2.start = false if v2.c.health == -20 then + local prevSave = love.filesystem.read("savegame.txt") + love.filesystem.write("savegame.txt", prevSave .. "v2.complete = true;virus2Lose = " .. virus2Lose .. ";") scene = 1 win[4].w = 200 antivirus.status = "Virus Defeated" |
