From 0f3687480cd228265353c6ccde3fecbaaa6b9f09 Mon Sep 17 00:00:00 2001 From: 1029chris <1029chris@gmail.com> Date: Sun, 21 Aug 2016 18:10:49 -0700 Subject: Virus 2 has more hands, the hands have a fade transition --- assets.lua | 9 ++++++ assets/virus2_hands_gunfront.png | Bin 0 -> 24125 bytes assets/virus2_hands_gunpoint.png | Bin 0 -> 24931 bytes assets/virus2_hands_gunup.png | Bin 0 -> 26653 bytes virus2.lua | 61 +++++++++++++++++++++++++++++++++++---- 5 files changed, 65 insertions(+), 5 deletions(-) create mode 100644 assets/virus2_hands_gunfront.png create mode 100644 assets/virus2_hands_gunpoint.png create mode 100644 assets/virus2_hands_gunup.png diff --git a/assets.lua b/assets.lua index c8256b6..199e3e5 100644 --- a/assets.lua +++ b/assets.lua @@ -241,8 +241,17 @@ function loadAssets(id) v2.c.idle.gunidle = love.graphics.newImage("assets/virus2_hands_gunidle.png") v2.c.idle.fist = love.graphics.newImage("assets/virus2_hands_fist.png") v2.c.idle.f = 1 + v2.c.gunfront = love.graphics.newImage("assets/virus2_hands_gunfront.png") + v2.c.gunpoint = love.graphics.newImage("assets/virus2_hands_gunpoint.png") + v2.c.gunup = love.graphics.newImage("assets/virus2_hands_gunup.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.handsOp = 0 + v2.c.gunidleOp = 0 + v2.c.fistOp = 0 + v2.c.gunfrontOp = 256 + v2.c.gunpointOp = 0 + v2.c.gunupOp = 0 v2.c.cockgunplay = false loadAnimation(v2.c.idle.pic, v2.c.idle.fs, 37, 10, 250, 250) v2.c.idle.mask = {} diff --git a/assets/virus2_hands_gunfront.png b/assets/virus2_hands_gunfront.png new file mode 100644 index 0000000..1ca182a Binary files /dev/null and b/assets/virus2_hands_gunfront.png differ diff --git a/assets/virus2_hands_gunpoint.png b/assets/virus2_hands_gunpoint.png new file mode 100644 index 0000000..a23ab62 Binary files /dev/null and b/assets/virus2_hands_gunpoint.png differ diff --git a/assets/virus2_hands_gunup.png b/assets/virus2_hands_gunup.png new file mode 100644 index 0000000..0ecd824 Binary files /dev/null and b/assets/virus2_hands_gunup.png differ diff --git a/virus2.lua b/virus2.lua index 3e4295d..49dc99d 100644 --- a/virus2.lua +++ b/virus2.lua @@ -38,9 +38,11 @@ function drawVirusFight2() elseif v2.c.chat.msgs == 2 then v2.c.xd = sys.w/3 v2.c.yd = sys.h/1.7 + v2.c.handp = "gunup" elseif v2.c.chat.msgs == 3 then v2.c.xd = sys.w/3 v2.c.yd = sys.h/3 + v2.c.handp = "idle" elseif v2.c.chat.msgs == 4 then v2.c.xd = sys.w/1.7 v2.c.yd = sys.h/1.7 @@ -212,14 +214,32 @@ function drawVirus2() v2.c.y = v2.c.y + v2.c.spy end end - if v2.c.handp == "idle" then + handOpa("idle",v2.c.handsOp) + handOpa("fist",v2.c.fistOp) + handOpa("gunup",v2.c.gunupOp) + handOpa("gunfront",v2.c.gunfrontOp) + handOpa("gunidle",v2.c.gunidleOp) + if v2.c.handsOp ~= 0 then + love.graphics.setColor(256,256,256,v2.c.handsOp) love.graphics.draw(v2.c.idle.hands, v2.c.x, v2.c.y, v2.c.r, v2.c.s, v2.c.s, 125, 125) - elseif v2.c.handp == "fist" then - love.graphics.draw(v2.c.idle.fist, v2.c.x, v2.c.y, v2.c.r, v2.c.s, v2.c.s, 125, 125) - elseif v2.c.handp == "gunidle" then + end + if v2.c.fistOp ~= 0 then + love.graphics.setColor(256,256,256,v2.c.fistOp) + love.graphics.draw(v2.c.idle.fist, v2.c.x+math.random(-0.2,0.2), v2.c.y+math.random(-0.2,0.2), v2.c.r, v2.c.s, v2.c.s, 125, 125) + end + if v2.c.gunidleOp ~= 0 then + love.graphics.setColor(256,256,256,v2.c.gunidleOp) love.graphics.draw(v2.c.idle.gunidle, v2.c.x, v2.c.y, v2.c.r, v2.c.s, v2.c.s, 125, 125) end - if v2.c.chat.time >= 2 then + if v2.c.gunfrontOp ~= 0 then + love.graphics.setColor(256,256,256,v2.c.gunfrontOp) + love.graphics.draw(v2.c.gunfront, v2.c.x, v2.c.y, v2.c.r, v2.c.s, v2.c.s, 125, 125) + end + if v2.c.gunupOp ~= 0 then + love.graphics.setColor(256,256,256,v2.c.gunupOp) + love.graphics.draw(v2.c.gunup, v2.c.x, v2.c.y, v2.c.r, v2.c.s, v2.c.s, 125, 125) + end + if v2.c.chat.time >= 2 and v2.msgs[v2.c.chat.msgs] ~= nil then drawBubble(v2.c.x+50, v2.c.y-160, 300, 115, v2.c.chat.msg) if mouseClick(v2.c.x+50,v2.c.y-160,300,110) == true and v2.c.chat.next == false then v2.c.chat.next = true @@ -242,3 +262,34 @@ function drawVirus2Stencil() 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 +function handOpa(hand,opa) + if v2.c.handp == hand then + if opa < 256 then + if hand == "idle" then + v2.c.handsOp = v2.c.handsOp + 16 + elseif hand == "fist" then + v2.c.fistOp = v2.c.fistOp + 16 + elseif hand == "gunfront" then + v2.c.gunfrontOp = v2.c.gunfrontOp + 16 + elseif hand == "gunidle" then + v2.c.gunidleOp = v2.c.gunidleOp + 16 + elseif hand == "gunup" then + v2.c.gunupOp = v2.c.gunupOp + 16 + end + end + else + if opa > 0 then + if hand == "idle" then + v2.c.handsOp = v2.c.handsOp - 16 + elseif hand == "fist" then + v2.c.fistOp = v2.c.fistOp - 16 + elseif hand == "gunfront" then + v2.c.gunfrontOp = v2.c.gunfrontOp - 16 + elseif hand == "gunidle" then + v2.c.gunidleOp = v2.c.gunidleOp - 16 + elseif hand == "gunup" then + v2.c.gunupOp = v2.c.gunupOp - 16 + end + end + end +end -- cgit