diff options
| author | 1029chris <1029chris@gmail.com> | 2016-04-24 16:56:06 -0700 |
|---|---|---|
| committer | 1029chris <1029chris@gmail.com> | 2016-04-24 16:56:06 -0700 |
| commit | 0d843207bc6fe33542c52596158779ae117c3e5d (patch) | |
| tree | c50c174d27e3f6c4b983d3278d170372abf79c30 | |
| parent | 8e9f003053e45103c4bf6ddbcd1429b8131ca89c (diff) | |
Added antivirus laser charge
you have to wait for it to charge before you can fire it
| -rw-r--r-- | assets.lua | 3 | ||||
| -rw-r--r-- | assets/antivirus_charge.png | bin | 0 -> 655 bytes | |||
| -rw-r--r-- | var.lua | 2 | ||||
| -rw-r--r-- | virus1.lua | 20 |
4 files changed, 21 insertions, 4 deletions
@@ -90,7 +90,8 @@ function loadAssets() opengun = love.audio.newSource("assets/antivirus_open_gun.ogg"), laser = love.audio.newSource("assets/antivirus_laser.ogg"), bullet = love.graphics.newImage("assets/bullet_blue.png"), - hit = love.audio.newSource("assets/antivirus_hit.ogg") + hit = love.audio.newSource("assets/antivirus_hit.ogg"), + charge = love.graphics.newImage("assets/antivirus_charge.png") } notification = { bubble = love.graphics.newImage("assets/notification.png"), diff --git a/assets/antivirus_charge.png b/assets/antivirus_charge.png Binary files differnew file mode 100644 index 0000000..076c21f --- /dev/null +++ b/assets/antivirus_charge.png @@ -97,7 +97,7 @@ function loadVar() av.wings = 0 av.gun = 0 av.transform = false - av.charge = 0 + av.charge = 40 av.fireb = false av.fire = false av.bullets = {} @@ -57,6 +57,11 @@ function drawVirusFight1() love.graphics.setColor(colors.font.dark) love.graphics.print("FIRE", win[4].x+138/2+76, win[4].y+99) love.graphics.setColor(256,256,256) + drawDownBox(win[4].x+138/2+79-1, win[4].y+40-1, 42, 42, 2) + love.graphics.stencil(chargeStencil, "replace", 1) + love.graphics.setStencilTest("greater", 0) + love.graphics.draw(antivirus.charge, win[4].x+138/2+79, win[4].y+40) + love.graphics.setStencilTest() if av.wings == 138/2 then love.graphics.draw(antivirus.left, win[4].x+138/2-av.wings, win[4].y, 0, win[4].s) love.graphics.draw(antivirus.right, win[4].x+138/2+97+av.wings, win[4].y, 0, win[4].s) @@ -72,7 +77,10 @@ function drawVirusFight1() if av.wings == 138/2 and av.gun ~= 98 then av.gun = av.gun + 1 end - if (sys.mouse.p.x >= win[4].x+138/2+71 and sys.mouse.p.x <= (win[4].x+138/2+71)+56 and av.fireb == true + if av.charge ~= 40 then + av.fireb = false + end + if (sys.mouse.p.x >= win[4].x+138/2+71 and sys.mouse.p.x <= (win[4].x+138/2+71)+56 and av.fireb == true and av.charge == 40 and sys.mouse.p.y >= win[4].y+93 and sys.mouse.p.y <= (win[4].y+93)+19 and sys.mouse.drag == false and sys.mouse.p.p == true) then av.fire = true av.fireb = false @@ -82,9 +90,14 @@ function drawVirusFight1() v1.c.chat.char = 0 end end - if v1.c.chat.msgs == 15 or v1.c.chat.msgs == 17 or v1.c.chat.msgs == 19 or v1.c.chat.msgs == 21 then + if (v1.c.chat.msgs == 15 or v1.c.chat.msgs == 17 or v1.c.chat.msgs == 19 or v1.c.chat.msgs == 21) and av.charge == 40 then av.fireb = true end + if av.charge < 40 then + av.charge = av.charge + math.random(1,10,25,40,5,2,8)*delta + elseif av.charge > 40 then + av.charge = 40 + end if av.fire == true then addBullet(win[4].x+138/2+99,win[4].y+5-av.gun,math.rad(-90),25,"av") antivirus.laser:play() @@ -314,3 +327,6 @@ function drawBullets() end end end +function chargeStencil() + love.graphics.rectangle("fill", win[4].x+138/2+79, win[4].y+40+40, 40, -av.charge) +end |
