aboutsummaryrefslogtreecommitdiff
path: root/virus1.lua
diff options
context:
space:
mode:
author1029chris <1029chris@gmail.com>2016-04-14 14:40:02 -0700
committer1029chris <1029chris@gmail.com>2016-04-14 14:40:02 -0700
commit6d54f2c8edbef92f04c55a7a281eb4f2713098c6 (patch)
tree6cea8a29e347a7c4a9883e38f563487fbc01b8cd /virus1.lua
parent48684ad8ada148db99828f3991a8d79e51abeef3 (diff)
Fixed crash after messages ran out
Diffstat (limited to 'virus1.lua')
-rw-r--r--virus1.lua14
1 files changed, 8 insertions, 6 deletions
diff --git a/virus1.lua b/virus1.lua
index d1cb637..393579f 100644
--- a/virus1.lua
+++ b/virus1.lua
@@ -35,18 +35,20 @@ function drawVirusFight1()
playAnimation(v1.c.idle, true, v1.c.x-40, v1.c.y+40, v1.c.r, v1.c.s, 100, 100, 0.5)
love.graphics.setColor(255,255,255)
playAnimation(v1.c.idle, true, v1.c.x, v1.c.y, v1.c.r, v1.c.s, 100, 100, 0.5)
- if v1.c.shine.s < -50 then
- drawBubble(v1.c.x+40, v1.c.y-160, 300, 110, v1.c.chat.msg)
+ if v1.c.shine.s < -50 and v1.msgs[v1.c.chat.msgs] ~= nil then
+ drawBubble(v1.c.x+40, v1.c.y-165, 300, 110, v1.c.chat.msg)
if (sys.mouse.p.x >= v1.c.x+40 and sys.mouse.p.x <= v1.c.x+40+300
- and sys.mouse.p.y >= v1.c.y-160 and sys.mouse.p.y <= v1.c.y-160+110 and
+ and sys.mouse.p.y >= v1.c.y-165 and sys.mouse.p.y <= v1.c.y-165+110 and
v1.c.chat.next == false and sys.mouse.drag == false) then
v1.c.chat.next = true
v1.c.chat.msgs = v1.c.chat.msgs + 1
v1.c.chat.char = 0
end
- 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 v1.msgs[v1.c.chat.msgs] ~= nil then
+ 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))
+ end
end
end
end