diff options
| -rw-r--r-- | chat.lua | 48 | ||||
| -rw-r--r-- | internet.lua | 25 | ||||
| -rw-r--r-- | main.lua | 3 | ||||
| -rw-r--r-- | var.lua | 5 |
4 files changed, 78 insertions, 3 deletions
@@ -5,7 +5,11 @@ function drawChat() drawDownBox(8, 320, win[1].w-17, 70, 4) love.graphics.setColor(250, 250, 250) love.graphics.rectangle("fill", 8, 320, win[1].w-17, 70) - drawUpBox(178, 321, 62, 68, 2) + if mouseClick(win[1].x+178, win[1].y+321, 62, 68) == true and layer[1] == 1 then + drawDownBox(178, 321, 62, 68, 2) + else + drawUpBox(178, 321, 62, 68, 2) + end love.graphics.setColor(colors.font.dark) love.graphics.print("Send", 186, 350) love.graphics.setColor(255, 255, 255) @@ -21,7 +25,7 @@ function drawChat() love.graphics.print(chat.profilename, 50, 41) love.graphics.setFont(pixeloperators) for i=1,chatlimit() do - if msg.msgs[i][1] == 1 then + if msg.msgs[i][1] == 1 or msg.msgs[i][1] == 3 then love.graphics.setColor(colors.font.friend) love.graphics.print("Friend:", 12, 300 - (28*i)) elseif msg.msgs[i][1] == 2 then @@ -31,13 +35,51 @@ function drawChat() love.graphics.setColor(colors.font.dark) love.graphics.print("\n" .. msg.msgs[i][2], 12, 300 - (28*i)) end + love.graphics.setColor(colors.font.dark) + if chat.blink == true then + love.graphics.print(chat.msg .. "_", 10, 320) + elseif chat.blink == false then + love.graphics.print(chat.msg, 10, 320) + end + love.graphics.print(18-string.len(chat.msg) .. "/18", 10, 370) love.graphics.setFont(pressstart) end function updateChat() + if mouseClick(win[1].x+178, win[1].y+321, 62, 68) == true and layer[1] == 1 then + if chat.msg ~= "" then + sendMessage(2, chat.msg) + if chat.status == 1 then + chatReply(string.lower(chat.msg)) + end + chat.msg = "" + end + win[1].update = true + end + chat.blinkTimer = chat.blinkTimer - delta + if chat.blinkTimer <= 0 then + if chat.blink == true then + chat.blink = false + elseif chat.blink == false then + chat.blink = true + end + win[1].update = true + chat.blinkTimer = 0.5 + end + chat.msgold = chat.msg if msg.new == true then win[1].update = true msg.new = false end + for i=1, #msg.r do + msg.r[i].t = msg.r[i].t - delta + end + for i=1, #msg.r do + if msg.r[i].t <= 0 then + sendMessage(3, msg.r[i].r[math.random(1,#msg.r[i].r)]) + table.remove(msg.r, i) + break + end + end end function sendMessage(id, message) msg.new = true @@ -45,7 +87,7 @@ function sendMessage(id, message) if win[1].ex == true or layer[1] ~= 1 then notifyNow("CHAT NOTIFICATION", "New message from\nBest Friend:\n" .. message) end - if msg.c ~= 21 then + if msg.c ~= 21 and id == 1 then msg.c = msg.c + 1 end end diff --git a/internet.lua b/internet.lua index 98ce15c..375b4cf 100644 --- a/internet.lua +++ b/internet.lua @@ -58,6 +58,21 @@ function updateInternet() win[2].update = true internet.load = 0 end + if key == "backspace" and layer[1] == 1 and v1.yes == false then + chat.msg = string.sub(chat.msg, 1, string.len(chat.msg)-1) + if chat.msg ~= chat.msgold then + win[1].update = true + chat.blink = true + chat.blinkTimer = 0.5 + end + end + if key == "return" and layer[1] == 1 and chat.msg ~= "" then + sendMessage(2, chat.msg) + if chat.status == 1 then + chatReply(string.lower(chat.msg)) + end + chat.msg = "" + end end function love.textinput(t) if layer[1] == 2 and v1.yes == false then @@ -68,6 +83,16 @@ function updateInternet() internet.blinkTimer = 0 end end + if layer[1] == 1 and v1.yes == false then + if string.len(chat.msg) < 18 then + chat.msg = chat.msg .. t + end + if chat.msg ~= chat.msgold then + win[1].update = true + chat.blink = true + chat.blinkTimer = 0.5 + end + end end if internet.load ~= 442 then if math.random(1,3) == 3 then @@ -98,6 +98,9 @@ function love.mousereleased(x, y, button) vplay.drag = false mplay.pr = false vplay.pr = false + if layer[1] == 1 then + win[1].update = true + end end end function love.draw() @@ -97,6 +97,10 @@ function loadVar() av.shakey = 0 chat.status = 0 chat.profilename = "Best Friend" + chat.msg = "" + chat.msgold = "" + chat.blink = false + chat.blinkTimer = 0.5 colors = {} colors.win = {} colors.win.light = {220,220,220} @@ -119,6 +123,7 @@ function loadVar() msg = {} msg.new = false msg.c = 1 + msg.r = {} msg.msgs = {} msgs = {} internet.url = "www.homepage.com" |
