From 33cce45e067eb3d716ad33b5752a838319125855 Mon Sep 17 00:00:00 2001 From: 1029chris <1029chris@gmail.com> Date: Thu, 4 Aug 2016 17:31:55 -0700 Subject: Added drawVirus2 function changed playAnimation to follow frames for mask Added virus2 x,y,r,s --- assets.lua | 3 +++ var.lua | 4 ++++ virus2.lua | 15 +++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/assets.lua b/assets.lua index a0217a6..d5c9af1 100644 --- a/assets.lua +++ b/assets.lua @@ -296,6 +296,9 @@ 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 + 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) end diff --git a/var.lua b/var.lua index 786abd7..29cf685 100644 --- a/var.lua +++ b/var.lua @@ -193,6 +193,10 @@ function loadVar() v2.pop.add = false v2.pop.hov = 0 v2.msgs = {} + v2.c.x = 300 + v2.c.y = 300 + v2.c.s = 1 + v2.c.r = 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 962988a..0c85929 100644 --- a/virus2.lua +++ b/virus2.lua @@ -101,3 +101,18 @@ function drawPopups() v2.pop.add = false end end +function drawVirus2() + love.graphics.setColor(255,255,255) + playAnimation(v2.c.idle, true, v2.c.x, v2.c.y, 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,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+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.setStencilTest() + love.graphics.draw(v2.c.idle.hands, v2.c.x, v2.c.y, v2.c.r, v2.c.s, v2.c.s, 125, 125) +end +function drawVirus2Stencil() + love.graphics.setShader(mask_effect) + playAnimation(v2.c.idle.mask, true, v2.c.x, v2.c.y, v2.c.r, v2.c.s, 125, 125, 0.5) + love.graphics.setShader() +end -- cgit