diff options
| author | 1029chris <1029chris@gmail.com> | 2016-08-18 21:51:09 -0700 |
|---|---|---|
| committer | 1029chris <1029chris@gmail.com> | 2016-08-18 21:51:09 -0700 |
| commit | 11ef7059e98555914a1bdebaae37433d64942c4e (patch) | |
| tree | b324c2bdc1da63d3e96eab4614b48ad407922595 | |
| parent | 353b8a912101d6f20eae1301805765d1223005a9 (diff) | |
Did more for virus 2 fight
- Added different hands
- Added shotgun fire and cock sounds
- Virus 2 moves around
| -rw-r--r-- | assets.lua | 4 | ||||
| -rw-r--r-- | assets/virus2_hands_fist.png | bin | 0 -> 22658 bytes | |||
| -rw-r--r-- | assets/virus2_hands_gunidle.png | bin | 0 -> 24853 bytes | |||
| -rw-r--r-- | assets/virus2_shotgun_cock.ogg | bin | 0 -> 9560 bytes | |||
| -rw-r--r-- | assets/virus2_shotgun_fire.ogg | bin | 0 -> 14175 bytes | |||
| -rw-r--r-- | var.lua | 7 | ||||
| -rw-r--r-- | virus2.lua | 65 |
7 files changed, 75 insertions, 1 deletions
@@ -237,7 +237,11 @@ function loadAssets(id) v2.c.idle.pic = love.graphics.newImage("assets/virus2_idle.png") v2.c.pupil = love.graphics.newImage("assets/virus2_pupil.png") v2.c.idle.hands = love.graphics.newImage("assets/virus2_hands_idle.png") + 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.cockgun = love.audio.newSource("assets/virus2_shotgun_cock.ogg") + v2.c.cockgunplay = false loadAnimation(v2.c.idle.pic, v2.c.idle.fs, 37, 10, 250, 250) v2.c.idle.mask = {} v2.c.idle.mask.fs = {} diff --git a/assets/virus2_hands_fist.png b/assets/virus2_hands_fist.png Binary files differnew file mode 100644 index 0000000..09fc6ad --- /dev/null +++ b/assets/virus2_hands_fist.png diff --git a/assets/virus2_hands_gunidle.png b/assets/virus2_hands_gunidle.png Binary files differnew file mode 100644 index 0000000..b492ee8 --- /dev/null +++ b/assets/virus2_hands_gunidle.png diff --git a/assets/virus2_shotgun_cock.ogg b/assets/virus2_shotgun_cock.ogg Binary files differnew file mode 100644 index 0000000..76a095c --- /dev/null +++ b/assets/virus2_shotgun_cock.ogg diff --git a/assets/virus2_shotgun_fire.ogg b/assets/virus2_shotgun_fire.ogg Binary files differnew file mode 100644 index 0000000..9874782 --- /dev/null +++ b/assets/virus2_shotgun_fire.ogg @@ -197,6 +197,12 @@ function loadVar() v2.c.y = sys.h/2 v2.c.s = 1 v2.c.r = 0 + v2.c.xd = 0 + v2.c.yd = 0 + v2.c.spx = 0 + v2.c.spy = 0 + v2.c.sp = 1 + v2.c.angle = 0 v2.startTime = 0 v2.start = false v2.startPopups = 10 @@ -208,6 +214,7 @@ function loadVar() v2.c.chat.sp = 0.5 v2.c.chat.char = 0 v2.c.chat.time = 0 + v2.c.handp = "idle" expl.deb[1].x = 0 expl.deb[1].y = 0 expl.deb[1].ym = 5 @@ -6,6 +6,33 @@ function drawVirusFight2() drawMenu() end drawStart() + if v2.c.chat.msgs == 1 or v2.c.chat.msgs == 6 then + v2.c.xd = sys.w/2 + v2.c.yd = sys.h/3 + if v2.c.chat.msgs == 6 then + v2.c.handp = "fist" + end + elseif v2.c.chat.msgs == 2 then + v2.c.xd = sys.w/3 + v2.c.yd = sys.h/1.7 + elseif v2.c.chat.msgs == 3 then + v2.c.xd = sys.w/3 + v2.c.yd = sys.h/3 + elseif v2.c.chat.msgs == 4 then + v2.c.xd = sys.w/1.7 + v2.c.yd = sys.h/1.7 + elseif v2.c.chat.msgs == 5 then + v2.c.xd = sys.w/2 + v2.c.yd = sys.h/2 + elseif v2.c.chat.msgs == 8 then + v2.c.xd = sys.w/2 + v2.c.yd = sys.h/2 + v2.c.handp = "gunidle" + if v2.c.cockgunplay == false then + v2.c.cockgun:play() + v2.c.cockgunplay = true + end + end end function drawPopup(id) love.graphics.setCanvas(v2.pop.p[id].cvs) @@ -132,7 +159,43 @@ function drawVirus2() 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) + 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.angle = math.atan2((v2.c.yd - v2.c.y), (v2.c.xd - v2.c.x)) + v2.c.spx = v2.c.sp * math.cos(v2.c.angle) + v2.c.spy = v2.c.sp * math.sin(v2.c.angle) + if v2.c.x > v2.c.xd then + if v2.c.x + v2.c.spx <= v2.c.xd then + v2.c.x = v2.c.xd + else + v2.c.x = v2.c.x + v2.c.spx + end + elseif v2.c.x < v2.c.xd then + if v2.c.x + v2.c.spx >= v2.c.xd then + v2.c.x = v2.c.xd + else + v2.c.x = v2.c.x + v2.c.spx + end + end + if v2.c.y > v2.c.yd then + if v2.c.y + v2.c.spy <= v2.c.yd then + v2.c.y = v2.c.yd + else + v2.c.y = v2.c.y + v2.c.spy + end + elseif v2.c.y < v2.c.yd then + if v2.c.y + v2.c.spy >= v2.c.yd then + v2.c.y = v2.c.yd + else + v2.c.y = v2.c.y + v2.c.spy + end + end + if v2.c.handp == "idle" then + 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 + 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 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 |
