aboutsummaryrefslogtreecommitdiff
path: root/virus2.lua
diff options
context:
space:
mode:
author1029chris <1029chris@gmail.com>2016-10-29 23:23:11 -0700
committer1029chris <1029chris@gmail.com>2016-10-29 23:23:11 -0700
commit9766801068cbbf0910c427bfc258681b89615e14 (patch)
treefdeadf4ff6615d5d41736e6edaf5fe49b808b09a /virus2.lua
parentc1c74810562915bf45e74cbef174d6caf13b0db2 (diff)
Added speaking sounds to both viruses
Diffstat (limited to 'virus2.lua')
-rw-r--r--virus2.lua10
1 files changed, 10 insertions, 0 deletions
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