aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--assets.lua2
-rw-r--r--assets/bullet_red.pngbin0 -> 263 bytes
-rw-r--r--assets/bullet_yellow.pngbin0 -> 247 bytes
-rw-r--r--var.lua6
-rw-r--r--virus1.lua86
-rw-r--r--window.lua25
6 files changed, 108 insertions, 11 deletions
diff --git a/assets.lua b/assets.lua
index dbf57ab..f58b911 100644
--- a/assets.lua
+++ b/assets.lua
@@ -128,6 +128,8 @@ function loadAssets()
v1.laserSound:setVolume(0.6)
v1.bullets = {}
v1.bullet = love.graphics.newImage("assets/bullet_green.png")
+ v1.bulletRed = love.graphics.newImage("assets/bullet_red.png")
+ v1.bulletYellow = love.graphics.newImage("assets/bullet_yellow.png")
v1.c.idle = {}
v1.c.idle.fs = {}
v1.c.idle.pic = love.graphics.newImage("assets/virus1_idle_noeye.png")
diff --git a/assets/bullet_red.png b/assets/bullet_red.png
new file mode 100644
index 0000000..ed2b08d
--- /dev/null
+++ b/assets/bullet_red.png
Binary files differ
diff --git a/assets/bullet_yellow.png b/assets/bullet_yellow.png
new file mode 100644
index 0000000..4878052
--- /dev/null
+++ b/assets/bullet_yellow.png
Binary files differ
diff --git a/var.lua b/var.lua
index 6059f7f..5ae3c1c 100644
--- a/var.lua
+++ b/var.lua
@@ -70,6 +70,9 @@ function loadVar()
loadWin(4, 200, 150, "Antivirus", icons[32].antivirus, icons[16].antivirus)
loadWin(5, 450, 400, "Help", icons[32].help, icons[16].help)
loadWin(6, 400, 550, "Settings", icons[32].settings, icons[16].settings)
+ win[4].crazy = false
+ win[4].crazyLeft = false
+ win[4].crazyUp = false
icon = {}
for i=1,6 do
loadIcon(i, 10, 10+(90*i-90))
@@ -138,7 +141,10 @@ function loadVar()
v1.explodeintro = false
v1.explodeintrotimer = 0
v1.fightTimer = 0
+ v1.turretTimer = 0
+ v1.turretAbi = 0
v1.spm = 1
+ v1.abis = 1
v1.left = false
expl.deb[1].x = 0
expl.deb[1].y = 0
diff --git a/virus1.lua b/virus1.lua
index 7395618..bfda9f8 100644
--- a/virus1.lua
+++ b/virus1.lua
@@ -258,6 +258,7 @@ function drawVirusFight1()
end
if v1.c.chat.msgs > 35 then
v1.fightTimer = v1.fightTimer + delta
+ v1.turretTimer = v1.turretTimer + delta
music.tension1:stop()
music.battle1:play()
for i=1,4 do
@@ -266,19 +267,19 @@ function drawVirusFight1()
-math.sin(v1.turret[i].r+math.rad(90))*(v1.turret[i].y-v1.turret[i].y)+v1.turret[i].x
local y = math.sin(v1.turret[i].r+math.rad(90))*(v1.turret[i].x+148-v1.turret[i].x)
+math.cos(v1.turret[i].r+math.rad(90))*(v1.turret[i].y-v1.turret[i].y)+v1.turret[i].y
- addBullet(x,y,v1.turret[i].r+math.rad(90),16*(v1.spm/2),"v1")
+ addBullet(x,y,v1.turret[i].r+math.rad(90),6*(0.75+(v1.spm/4)),"v1",i)
if v1.laserSound:isPlaying() == true then
v1.laserSound:rewind()
else
v1.laserSound:play()
end
v1.turret[i].t = 0
- v1.turret[i].tl = math.random(2,3,4,5)/(v1.spm/2)
- elseif v1.turret[i].t < v1.turret[i].tl then
+ v1.turret[i].tl = (math.random(2,5)/v1.spm)*2
+ elseif v1.turret[i].t < v1.turret[i].tl and v1.turretTimer < 30 then
v1.turret[i].t = v1.turret[i].t+delta
end
end
- if v1.c.x == v1.c.xd then
+ if v1.c.x == v1.c.xd and v1.turretTimer < 30 then
if v1.left == true then
v1.left = false
if v1.c.health > 70 then
@@ -295,6 +296,54 @@ function drawVirusFight1()
end
end
end
+ if v1.c.y == v1.c.yd and v1.c.health < 45 and v1.turretTimer < 30 then
+ v1.c.yd = math.random(100,sys.h/2-100)
+ elseif v1.turretTimer < 30 and v1.c.health > 40 then
+ v1.c.yd = 140
+ end
+ if v1.turretTimer >= 30 then
+ v1.c.xd = win[4].x+win[4].w/2
+ v1.c.yd = win[4].y-400
+ if v1.turretTimer >= 31 and v1.turretAbi == 0 then
+ for i=1,4 do
+ local x = math.cos(v1.turret[i].r+math.rad(90))*(v1.turret[i].x+148-v1.turret[i].x)
+ -math.sin(v1.turret[i].r+math.rad(90))*(v1.turret[i].y-v1.turret[i].y)+v1.turret[i].x
+ local y = math.sin(v1.turret[i].r+math.rad(90))*(v1.turret[i].x+148-v1.turret[i].x)
+ +math.cos(v1.turret[i].r+math.rad(90))*(v1.turret[i].y-v1.turret[i].y)+v1.turret[i].y
+ addBullet(x,y,v1.turret[i].r+math.rad(90),20,"v1",2)
+ end
+ if v1.laserSound:isPlaying() == true then
+ v1.laserSound:rewind()
+ else
+ v1.laserSound:play()
+ end
+ v1.turretAbi = 1
+ end
+ if v1.turretTimer >= 31.5 and v1.turretAbi == 1 then
+ for i=1,4 do
+ local x = math.cos(v1.turret[i].r+math.rad(90))*(v1.turret[i].x+148-v1.turret[i].x)
+ -math.sin(v1.turret[i].r+math.rad(90))*(v1.turret[i].y-v1.turret[i].y)+v1.turret[i].x
+ local y = math.sin(v1.turret[i].r+math.rad(90))*(v1.turret[i].x+148-v1.turret[i].x)
+ +math.cos(v1.turret[i].r+math.rad(90))*(v1.turret[i].y-v1.turret[i].y)+v1.turret[i].y
+ addBullet(x,y,v1.turret[i].r+math.rad(90),20,"v1",v1.abis)
+ end
+ if v1.abis == 5 then
+ v1.abis = 1
+ elseif v1.abis == 1 then
+ v1.abis = 5
+ end
+ if v1.laserSound:isPlaying() == true then
+ v1.laserSound:rewind()
+ else
+ v1.laserSound:play()
+ end
+ v1.turretAbi = 2
+ end
+ if v1.turretAbi == 2 and v1.turretTimer >= 33 then
+ v1.turretTimer = 0
+ v1.turretAbi = 0
+ end
+ end
end
v1.c.sp = math.sqrt(math.abs(v1.c.xd - v1.c.x)*2 + math.abs(v1.c.yd - v1.c.y)*2)/5
if v1.c.chat.msgs == 8 then
@@ -399,12 +448,12 @@ function drawVirusFight1()
drawBullets()
drawStart()
end
-function addBullet(x,y,a,s,t)
+function addBullet(x,y,a,s,t,id)
if t == "av" then
table.insert(av.bullets, 1, {x=x,y=y,a=a,s=s,spx=0,spy=0,rm=false})
end
if t == "v1" then
- table.insert(v1.bullets, 1, {x=x,y=y,a=a,s=s,spx=0,spy=0,rm=false})
+ table.insert(v1.bullets, 1, {x=x,y=y,a=a,s=s,spx=0,spy=0,rm=false,id=id})
end
end
function drawBullets()
@@ -414,17 +463,32 @@ function drawBullets()
v1.bullets[i].spy = v1.bullets[i].s * math.sin(v1.bullets[i].a)
v1.bullets[i].x = v1.bullets[i].x + v1.bullets[i].spx
v1.bullets[i].y = v1.bullets[i].y + v1.bullets[i].spy
- love.graphics.draw(v1.bullet, v1.bullets[i].x, v1.bullets[i].y, v1.bullets[i].a, 1.5, 1.5, 23/2, 7)
+ if v1.bullets[i].id == 2 or v1.bullets[i].id == 3 then
+ love.graphics.draw(v1.bulletRed, v1.bullets[i].x, v1.bullets[i].y, v1.bullets[i].a, 1.5, 1.5, 23/2, 7)
+ elseif v1.bullets[i].id == 1 or v1.bullets[i].id == 4 then
+ love.graphics.draw(v1.bullet, v1.bullets[i].x, v1.bullets[i].y, v1.bullets[i].a, 1.5, 1.5, 23/2, 7)
+ elseif v1.bullets[i].id == 5 then
+ love.graphics.draw(v1.bulletYellow, v1.bullets[i].x, v1.bullets[i].y, v1.bullets[i].a, 1.5, 1.5, 23/2, 7)
+ end
if v1.bullets[i].x < 0 or v1.bullets[i].x > sys.w or v1.bullets[i].y < 0 or v1.bullets[i].y > sys.h then
v1.bullets[i].rm = true
end
if (v1.bullets[i].x >= win[4].x and v1.bullets[i].x <= win[4].x+win[4].w
and v1.bullets[i].y >= win[4].y and v1.bullets[i].y <= win[4].y+win[4].h) then
v1.bullets[i].rm = true
- if av.charge - 10 < 0 then
- av.charge = 0
- else
- av.charge = av.charge - 10
+ if v1.bullets[i].id == 1 or v1.bullets[i].id == 4 then
+ if av.charge - 10 < 0 then
+ av.charge = 0
+ else
+ av.charge = av.charge - 10
+ end
+ elseif v1.bullets[i].id == 2 or v1.bullets[i].id == 3 then
+ sys.mouse.drag = false
+ win[4].hover = false
+ elseif v1.bullets[i].id == 5 then
+ sys.mouse.drag = false
+ win[4].hover = false
+ win[4].crazy = true
end
if antivirus.hit:isPlaying() == true then
antivirus.hit:rewind()
diff --git a/window.lua b/window.lua
index 5913573..c6b0a80 100644
--- a/window.lua
+++ b/window.lua
@@ -127,6 +127,31 @@ function drawWindow(id)
if win[id].miny < 0 then
win[id].miny = 0
end
+ if id == 4 and win[4].crazy == true then
+ if win[4].crazyLeft == true and win[4].x > 100 then
+ win[4].x = win[4].x - 10+v1.spm
+ elseif win[4].crazyLeft == false and win[4].x < sys.w-300 then
+ win[4].x = win[4].x + 10+v1.spm
+ end
+ if win[4].x <= 100 then
+ win[4].crazyLeft = false
+ elseif win[4].x >= sys.w-300 then
+ win[4].crazyLeft = true
+ end
+ if win[4].crazyUp == true and win[4].y > sys.h/2+50 then
+ win[4].y = win[4].y - 5+v1.spm
+ elseif win[4].crazyUp == false and win[4].y < sys.h-panel.thick-200 then
+ win[4].y = win[4].y + 5+v1.spm
+ end
+ if win[4].y <= sys.h/2+50 then
+ win[4].crazyUp = false
+ elseif win[4].y >= sys.h-panel.thick-200 then
+ win[4].crazyUp = true
+ end
+ if sys.mouse.drag == true then
+ win[4].crazy = false
+ end
+ end
if id == 4 then
updateAntivirus()
elseif id == 1 then