From 9766801068cbbf0910c427bfc258681b89615e14 Mon Sep 17 00:00:00 2001 From: 1029chris <1029chris@gmail.com> Date: Sat, 29 Oct 2016 23:23:11 -0700 Subject: Added speaking sounds to both viruses --- assets.lua | 2 ++ assets/virus1_voice.ogg | Bin 0 -> 5491 bytes assets/virus2_voice.ogg | Bin 0 -> 5717 bytes var.lua | 2 ++ virus1.lua | 10 ++++++++++ virus2.lua | 10 ++++++++++ 6 files changed, 24 insertions(+) create mode 100644 assets/virus1_voice.ogg create mode 100644 assets/virus2_voice.ogg diff --git a/assets.lua b/assets.lua index 0a1877c..017b140 100644 --- a/assets.lua +++ b/assets.lua @@ -182,6 +182,7 @@ function loadAssets(id) tent2 = love.graphics.newImage("assets/tentacle2.png"), lidup = love.graphics.newImage("assets/v1_upper_eyelid.png"), lidlow = love.graphics.newImage("assets/v1_lower_eyelid.png") + voice = love.audio.newSource("assets/virus1_voice.ogg") } end if id == 14 then @@ -266,6 +267,7 @@ function loadAssets(id) v2.c.idle.mask.fs = {} v2.c.idle.mask.pic = love.graphics.newImage("assets/virus2_idle_mask.png") v2.c.idle.mask.f = 1 + v2.voice = love.audio.newSource("assets/virus2_voice.ogg") loadAnimation(v2.c.idle.mask.pic, v2.c.idle.mask.fs, 37, 10, 250, 250) end if id == 15 then diff --git a/assets/virus1_voice.ogg b/assets/virus1_voice.ogg new file mode 100644 index 0000000..20ce66e Binary files /dev/null and b/assets/virus1_voice.ogg differ diff --git a/assets/virus2_voice.ogg b/assets/virus2_voice.ogg new file mode 100644 index 0000000..120a6f4 Binary files /dev/null and b/assets/virus2_voice.ogg differ diff --git a/var.lua b/var.lua index 30dec0b..cb634fb 100644 --- a/var.lua +++ b/var.lua @@ -189,6 +189,7 @@ function loadVar() v1.lid.upyd = -25 v1.lid.bTimer = math.random(4,8) v1.lid.b = false + v1.prevChar = 0 v2.pop.p = {} v2.pop.add = false v2.pop.hov = 0 @@ -243,6 +244,7 @@ function loadVar() v2.nextAttack = 20 v2.popupTimer = 60 v2.shotgunTimer = 10 + v2.prevChar = 0 expl.deb[1].x = 0 expl.deb[1].y = 0 expl.deb[1].ym = 5 diff --git a/virus1.lua b/virus1.lua index 11aa902..7dd3d30 100644 --- a/virus1.lua +++ b/virus1.lua @@ -242,6 +242,16 @@ function drawVirusFight1() if string.len(v1.msgs[v1.c.chat.msgs]) ~= string.len(v1.c.chat.msg) then v1.c.chat.char = v1.c.chat.char + v1.c.chat.sp*(60/love.timer.getFPS()) v1.c.chat.msg = string.sub(v1.msgs[v1.c.chat.msgs], 1, math.floor(v1.c.chat.char)) + if math.floor(v1.c.chat.char) ~= math.floor(v1.prevChar) then + v1.voice:setPitch(math.random(8,12)/10) + v1.voice:setVolume(1) + if v1.voice:isPlaying() == true then + v1.voice:rewind() + else + v1.voice:play() + end + v1.prevChar = math.floor(v1.c.chat.char) + end end end end diff --git a/virus2.lua b/virus2.lua index ecdc7dc..5bdd6aa 100644 --- a/virus2.lua +++ b/virus2.lua @@ -415,6 +415,16 @@ function drawVirus2() if string.len(v2.msgs[v2.c.chat.msgs]) ~= string.len(v2.c.chat.msg) then v2.c.chat.char = v2.c.chat.char + v2.c.chat.sp*(60/love.timer.getFPS()) v2.c.chat.msg = string.sub(v2.msgs[v2.c.chat.msgs], 1, math.floor(v2.c.chat.char)) + if math.floor(v2.c.chat.char) ~= math.floor(v2.prevChar) then + v2.voice:setPitch(math.random(10,14)/10) + v2.voice:setVolume(0.4) + if v2.voice:isPlaying() == true then + v2.voice:rewind() + else + v2.voice:play() + end + v2.prevChar = math.floor(v2.c.chat.char) + end end end else -- cgit