mirror of
https://github.com/LDDestroier/CC/
synced 2025-09-02 02:48:01 +00:00
Update tron
This commit is contained in:
16
tron
16
tron
@@ -36,14 +36,15 @@ local nou = 2
|
|||||||
local keysDown = {}
|
local keysDown = {}
|
||||||
local netKeysDown = {}
|
local netKeysDown = {}
|
||||||
|
|
||||||
|
-- the scrolling of the screen
|
||||||
local scrollX = 0
|
local scrollX = 0
|
||||||
local scrollY = 0
|
local scrollY = 0
|
||||||
|
|
||||||
|
-- used when panning with WASD
|
||||||
local scrollAdjX = 0
|
local scrollAdjX = 0
|
||||||
local scrollAdjY = 0
|
local scrollAdjY = 0
|
||||||
|
|
||||||
local lockInput = false
|
local lockInput = false
|
||||||
|
|
||||||
local player
|
local player
|
||||||
|
|
||||||
local resetPlayers = function()
|
local resetPlayers = function()
|
||||||
@@ -570,6 +571,11 @@ local sendInfo = function(gameID)
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local waitForKey = function(time)
|
||||||
|
sleep(time or 0.1)
|
||||||
|
os.pullEvent("char")
|
||||||
|
end
|
||||||
|
|
||||||
local deadAnimation = function(doSend)
|
local deadAnimation = function(doSend)
|
||||||
for k,v in pairs(deadGuys) do
|
for k,v in pairs(deadGuys) do
|
||||||
player[k].char = "X"
|
player[k].char = "X"
|
||||||
@@ -584,19 +590,19 @@ local deadAnimation = function(doSend)
|
|||||||
scrollToPosition(player[nou].x, player[nou].y)
|
scrollToPosition(player[nou].x, player[nou].y)
|
||||||
scrollToPosition(player[you].x, player[you].y)
|
scrollToPosition(player[you].x, player[you].y)
|
||||||
drawImage(images.tie, math.floor(scr_x / 2 - images.tie.x / 2), math.floor(scr_y / 2 - images.tie.y / 2))
|
drawImage(images.tie, math.floor(scr_x / 2 - images.tie.x / 2), math.floor(scr_y / 2 - images.tie.y / 2))
|
||||||
sleep(1.5)
|
waitForKey(1)
|
||||||
return "end"
|
return "end"
|
||||||
else
|
else
|
||||||
if deadGuys[you] then
|
if deadGuys[you] then
|
||||||
scrollX, scrollY = player[nou].x - scr_x / 2, player[nou].y - scr_y / 2
|
scrollX, scrollY = player[nou].x - scr_x / 2, player[nou].y - scr_y / 2
|
||||||
scrollToPosition(player[you].x, player[you].y)
|
scrollToPosition(player[you].x, player[you].y)
|
||||||
drawImage(images.lose, math.floor(scr_x / 2 - images.lose.x / 2), math.floor(scr_y / 2 - images.lose.y / 2))
|
drawImage(images.lose, math.floor(scr_x / 2 - images.lose.x / 2), math.floor(scr_y / 2 - images.lose.y / 2))
|
||||||
sleep(1.5)
|
waitForKey(1)
|
||||||
return "end"
|
return "end"
|
||||||
elseif deadGuys[nou] then
|
elseif deadGuys[nou] then
|
||||||
scrollToPosition(player[nou].x, player[nou].y)
|
scrollToPosition(player[nou].x, player[nou].y)
|
||||||
drawImage(images.win, math.floor(scr_x / 2 - images.win.x / 2), math.floor(scr_y / 2 - images.win.y / 2))
|
drawImage(images.win, math.floor(scr_x / 2 - images.win.x / 2), math.floor(scr_y / 2 - images.win.y / 2))
|
||||||
sleep(1.5)
|
waitForKey(1)
|
||||||
return "end"
|
return "end"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -753,4 +759,4 @@ while true do
|
|||||||
elseif decision == "exit" then
|
elseif decision == "exit" then
|
||||||
return cleanExit()
|
return cleanExit()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user