aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author1029chris <1029chris@gmail.com>2016-11-12 04:54:01 -0800
committer1029chris <1029chris@gmail.com>2016-11-12 04:54:01 -0800
commite7a66c699ad6d140f04f29a835f936d7b64c01d4 (patch)
tree1fedf70f26b0d4ed0aad965d634a33e00b9a3a9d
parent06153021393c736a3e1a15f388d5d8dca6844748 (diff)
Virus 2 now blinks and looks around
lowered volume on gun sounds for second virus fight fixed some bugs
-rw-r--r--assets.lua6
-rw-r--r--assets/virus2_idle_mask.pngbin15206 -> 15139 bytes
-rw-r--r--var.lua12
-rw-r--r--virus2.lua76
4 files changed, 87 insertions, 7 deletions
diff --git a/assets.lua b/assets.lua
index 1dfebcf..d2b722e 100644
--- a/assets.lua
+++ b/assets.lua
@@ -256,6 +256,8 @@ function loadAssets(id)
v2.c.gunleft = love.graphics.newImage("assets/virus2_hands_left.png")
v2.c.cockgun = love.audio.newSource("assets/virus2_shotgun_cock.ogg")
v2.c.fire = love.audio.newSource("assets/virus2_shotgun_fire.ogg")
+ v2.c.fire:setVolume(0.6)
+ v2.c.cockgun:setVolume(0.7)
v2.c.handsOp = 0
v2.c.spreadOp = 0
v2.c.gunidleOp = 0
@@ -324,8 +326,8 @@ function loadAnimation(pic, quad, frames, limit, w, h)
end
end
function playAnimation(ani, loop, x, y, r, s, xo, yo, sp)
- if ani == v2.c.idle.mask then
- ani.f = v2.c.idle.f
+ if ani == v2.c.idle then
+ v2.maskFrame = ani.f
end
if ani.fs[math.floor(ani.f)] ~= nil then
love.graphics.draw(ani.pic, ani.fs[math.floor(ani.f)], x, y, r, s, s, xo, yo)
diff --git a/assets/virus2_idle_mask.png b/assets/virus2_idle_mask.png
index ba97367..f2f1eb6 100644
--- a/assets/virus2_idle_mask.png
+++ b/assets/virus2_idle_mask.png
Binary files differ
diff --git a/var.lua b/var.lua
index 4537542..d7aa04d 100644
--- a/var.lua
+++ b/var.lua
@@ -259,6 +259,18 @@ function loadVar()
v2.v1gun = 203
v2.v1gunTimer = 1
v2.v1gunFire = false
+ v2.lid = {}
+ v2.lid.lowy = 25
+ v2.lid.upy = -25
+ v2.lid.lowyd = 25
+ v2.lid.upyd = -25
+ v2.lid.bTimer = math.random(4,8)
+ v2.lid.b = false
+ v2.maskFrame = 0
+ v2.c.eyex = 0
+ v2.c.eyey = 0
+ v2.c.eyetx = 0
+ v2.c.eyety = 0
expl.deb[1].x = 0
expl.deb[1].y = 0
expl.deb[1].ym = 5
diff --git a/virus2.lua b/virus2.lua
index f18d93f..28b6139 100644
--- a/virus2.lua
+++ b/virus2.lua
@@ -256,7 +256,7 @@ function drawVirusFight2()
v2.c.handp = "fist"
end
if v2.fightStart == true and v2.c.chat.msgs == 24 then
- music.battle2:setVolume(1)
+ music.battle2:setVolume(0.9)
music.tension2:stop()
music.battle2:play()
music.realization:stop()
@@ -464,9 +464,73 @@ function drawVirus2()
playAnimation(v2.c.idle, true, v2.c.x+v2.shakex, v2.c.y+v2.shakey, v2.c.r, v2.c.s, 125, 125, 0.5)
love.graphics.stencil(drawVirus2Stencil, "replace", 1)
love.graphics.setStencilTest("greater", 0)
- love.graphics.draw(v2.c.pupil, v2.c.x-26+math.random(-0.7+(v2.shakex/10),0.7+(v2.shakex/10)),
- v2.c.y-57+math.random(-0.7+(v2.shakey/10),0.7+(v2.shakey/10)),v2.c.r,v2.c.s)
- love.graphics.draw(v2.c.pupil, v2.c.x+21+math.random(-0.7,0.7),v2.c.y-57+math.random(-0.7,0.7),v2.c.r,v2.c.s)
+ love.graphics.draw(v2.c.pupil, v2.c.x-26+v2.c.eyex+math.random(-0.7+(v2.shakex/10),0.7+(v2.shakex/10)),
+ v2.c.y-57+v2.c.eyey+math.random(-0.7+(v2.shakey/10),0.7+(v2.shakey/10)),v2.c.r,v2.c.s)
+ love.graphics.draw(v2.c.pupil, v2.c.x+21+v2.c.eyex+math.random(-0.7,0.7),v2.c.y+v2.c.eyey-57+math.random(-0.7,0.7),v2.c.r,v2.c.s)
+ if v2.c.chat.msgs < 16 or v2.c.chat.msgs == 18 or v2.c.chat.msgs > 31 then
+ v2.c.eyex = 0
+ v2.c.eyey = 0
+ elseif v2.c.chat.msgs > 24 and v2.msgs[v2.c.chat.msgs] ~= nil then
+ v2.c.eyex = 0
+ v2.c.eyey = 0
+ elseif v2.c.chat.msgs == 17 or v2.c.chat.msgs >= 19 or v2.c.chat.msgs <= 21 then
+ v2.c.eyex = (win[4].x-v2.c.x)/sys.w*12
+ v2.c.eyey = (win[4].y-v2.c.y)/sys.h*6-1
+ elseif av.bullets[1] ~= nil then
+ v2.c.eyex = (av.bullets[1].x-v2.c.x)/sys.w*12
+ v2.c.eyey = (av.bullets[1].y-v2.c.y)/sys.h*6-1
+ else
+ v2.c.eyex = (sys.mouse.x-v2.c.x)/sys.w*12
+ v2.c.eyey = (sys.mouse.y-v2.c.y)/sys.h*6-1
+ end
+ v2.lid.bTimer = v2.lid.bTimer - delta
+ if v2.lid.bTimer <= 0 then
+ v2.lid.b = true
+ end
+ if v2.lid.b == true then
+ v2.lid.lowyd = 0
+ v2.lid.upyd = 0
+ end
+ if v2.lid.upy == 0 and v2.lid.lowy == 0 then
+ v2.lid.lowyd = 25
+ v2.lid.upyd = -25
+ v2.lid.b = false
+ v2.lid.bTimer = math.random(4,8)
+ end
+ if v2.lid.lowy > v2.lid.lowyd then
+ if v2.lid.lowy - 3*sys.s < v2.lid.lowyd then
+ v2.lid.lowy = v2.lid.lowyd
+ else
+ v2.lid.lowy = v2.lid.lowy - 3*sys.s
+ end
+ elseif v2.lid.lowy < v2.lid.lowyd then
+ if v2.lid.lowy + 3*sys.s > v2.lid.lowyd then
+ v2.lid.lowy = v2.lid.lowyd
+ else
+ v2.lid.lowy = v2.lid.lowy + 3*sys.s
+ end
+ end
+ if v2.lid.upy > v2.lid.upyd then
+ if v2.lid.upy - 3*sys.s < v2.lid.upyd then
+ v2.lid.upy = v2.lid.upyd
+ else
+ v2.lid.upy = v2.lid.upy - 3*sys.s
+ end
+ elseif v2.lid.upy < v2.lid.upyd then
+ if v2.lid.upy + 3*sys.s > v2.lid.upyd then
+ v2.lid.upy = v2.lid.upyd
+ else
+ v2.lid.upy = v2.lid.upy + 3*sys.s
+ end
+ end
+ love.graphics.setColor(0,0,0)
+ if v2.lid.upy ~= -25 then
+ love.graphics.rectangle("fill", v2.c.x-48+v2.shakex, v2.c.y-63+v2.lid.upy+v2.shakey, 95, 26)
+ end
+ if v2.lid.lowy ~= 25 then
+ love.graphics.rectangle("fill", v2.c.x-48+v2.shakex, v2.c.y-63+v2.lid.lowy+v2.shakey, 95, 26)
+ end
+ love.graphics.setColor(255,255,255)
love.graphics.setStencilTest()
v2.c.sp = math.sqrt(math.abs(v2.c.xd - v2.c.x)*2 + math.abs(v2.c.yd - v2.c.y)*2)/5
v2.c.sp = v2.c.sp * v2.spm
@@ -603,7 +667,9 @@ function drawVirus2()
end
function drawVirus2Stencil()
love.graphics.setShader(mask_effect)
- playAnimation(v2.c.idle.mask, true, v2.c.x+v2.shakex, v2.c.y+v2.shakey, v2.c.r, v2.c.s, 125, 125, 0.5)
+ if v2.c.idle.mask.fs[math.floor(v2.maskFrame)] ~= nil then
+ love.graphics.draw(v2.c.idle.mask.pic, v2.c.idle.mask.fs[math.floor(v2.maskFrame)], v2.c.x+v2.shakex, v2.c.y+v2.shakey, v2.c.r, v2.c.s, v2.c.s, 125,125)
+ end
love.graphics.setShader()
end
function handOpa(hand,opa)