From 4515e6a967d283d3921a8695f9d093ef0688902e Mon Sep 17 00:00:00 2001 From: 1029chris <1029chris@gmail.com> Date: Mon, 8 Aug 2016 00:05:07 -0700 Subject: Starting Virus 2 fight Added scene 3 Virus 2 appears after closing a popup --- desktop.lua | 2 +- main.lua | 2 ++ panel.lua | 3 +-- system.lua | 14 ++++++++++++++ var.lua | 8 ++++++-- virus2.lua | 19 ++++++++++++++++--- window.lua | 3 +++ 7 files changed, 43 insertions(+), 8 deletions(-) diff --git a/desktop.lua b/desktop.lua index b841974..e40fb2e 100644 --- a/desktop.lua +++ b/desktop.lua @@ -68,7 +68,7 @@ function drawIcon(id, x, y) end function checkIcon(id) if(sys.mouse.p.x >= icon[id].x+4 and sys.mouse.p.x <= icon[id].x+100 and sys.mouse.p.p == true - and sys.mouse.p.y >= icon[id].y and sys.mouse.p.y <= icon[id].y+75 and v1.yes == false) then + and sys.mouse.p.y >= icon[id].y and sys.mouse.p.y <= icon[id].y+75 and v1.yes == false and v2.start == false) then if icon[id].hl == false and icon[id].cl == false then icon[id].hl = true icon[id].cl = true diff --git a/main.lua b/main.lua index bc95ab6..868af10 100644 --- a/main.lua +++ b/main.lua @@ -112,6 +112,8 @@ function love.draw() drawLoading() elseif scene == 2 then drawVirusFight1() + elseif scene == 3 then + drawVirusFight2() elseif scene == 666 then drawBSOD() end diff --git a/panel.lua b/panel.lua index 55ad193..9e66e8a 100644 --- a/panel.lua +++ b/panel.lua @@ -69,7 +69,6 @@ function drawStart() start.o = false elseif start.o == false then start.o = true - --sendMessage(1, msgs[msg.c]) end end if v1.c.chat.msgs > 35 and v1.yes == true then @@ -139,7 +138,7 @@ function drawMenuItems(id) love.graphics.rectangle("fill", 35, 5+(id*55-55), 208, 50) love.graphics.setColor(colors.win.light) love.graphics.print(win[id].title, 85, 5+22+(id*55-55)) - if sys.mouse.p.p == true and v1.yes == false then + if sys.mouse.p.p == true and v1.yes == false and v2.start == false then if win[id].ex == true then win[id].ex = false win[id].s = 0.2 diff --git a/system.lua b/system.lua index 5ec8f71..186f356 100644 --- a/system.lua +++ b/system.lua @@ -11,6 +11,17 @@ function updateSystem(dt) chat.status = 1 msgssent = msgssent + 1 end + if v1.complete == true and v2.start == false then + v2.startTime = v2.startTime + dt + if v2.startTime >= 20 then + v2.start = true + addPopup(false, sys.w/2-300, sys.h/2-200, 600, 400, 1, false, true) + end + if v2.startTime >= v2.startPopups and v2.start == false then + v2.startPopups = v2.startPopups + 5 + addPopup(true) + end + end end function drawSystem() love.graphics.setBackgroundColor(0, 128, 128) @@ -26,6 +37,9 @@ function drawSystem() for i=1,#layer do drawLayer((#layer+1)-i) end + if v1.complete == true and v2.complete == false then + drawPopups() + end drawStart() if start.o == true then drawMenu() diff --git a/var.lua b/var.lua index 29cf685..6773eb2 100644 --- a/var.lua +++ b/var.lua @@ -193,10 +193,14 @@ function loadVar() v2.pop.add = false v2.pop.hov = 0 v2.msgs = {} - v2.c.x = 300 - v2.c.y = 300 + v2.c.x = sys.w/2 + v2.c.y = sys.h/2 v2.c.s = 1 v2.c.r = 0 + v2.startTime = 0 + v2.start = false + v2.startPopups = 10 + v2.complete = false expl.deb[1].x = 0 expl.deb[1].y = 0 expl.deb[1].ym = 5 diff --git a/virus2.lua b/virus2.lua index f95712e..a2a9c6f 100644 --- a/virus2.lua +++ b/virus2.lua @@ -1,4 +1,11 @@ function drawVirusFight2() + drawDesktop() + drawVirus2() + drawPopups() + if start.o == true then + drawMenu() + end + drawStart() end function drawPopup(id) love.graphics.setCanvas(v2.pop.p[id].cvs) @@ -35,7 +42,7 @@ function drawPopup(id) love.graphics.draw(v2.pop.a[v2.pop.p[id].ad], 8, 31, 0, (v2.pop.p[id].w-16)/640, (v2.pop.p[id].h-39)/400) love.graphics.setCanvas() end -function addPopup(rand, x, y, w, h, ad) +function addPopup(rand, x, y, w, h, ad, dup, m) if rand == true then table.insert(v2.pop.p, 1, { w = math.random(300,800), @@ -43,7 +50,8 @@ function addPopup(rand, x, y, w, h, ad) d = false, s = 0.2, exit = false, - add = false + add = false, + dup = true }) v2.pop.p[1].h = v2.pop.p[1].w/math.random(1.4,1.6,1.8,2) v2.pop.p[1].x = math.random(0,sys.w-v2.pop.p[1].w) @@ -54,7 +62,12 @@ function addPopup(rand, x, y, w, h, ad) v2.pop.p[1].d = true end elseif rand == false then - table.insert(v2.pop.p, 1, {x=x,y=y,w=w,h=h,ad=ad}) + table.insert(v2.pop.p, 1, {x=x,y=y,w=w,h=h,ad=ad,d=false,s=0.2,exit=false,add=false,dup=dup,m=m}) + v2.pop.p[1].cvs = love.graphics.newCanvas(v2.pop.p[1].w, v2.pop.p[1].h) + if v2.pop.p[1].d == false then + drawPopup(1) + v2.pop.p[1].d = true + end end end function drawPopups() diff --git a/window.lua b/window.lua index dd38c99..8492e53 100644 --- a/window.lua +++ b/window.lua @@ -115,6 +115,9 @@ function drawWindow(id) if v1.yes == true and id ~= 2 and win[id].ex == false and v1.timer >= 4 and v1.c.chat.msgs < 7 then win[id].ex = true end + if v2.start == true then + win[id].ex = true + end if v1.yes == true and id == 2 and v1.timer >= 4 then layer.sendToFront = 2 end -- cgit