1
0
mirror of https://github.com/LDDestroier/CC/ synced 2025-06-10 06:34:06 +00:00

Update tron

This commit is contained in:
LDDestroier 2018-11-14 16:26:04 -05:00 committed by GitHub
parent 9200f46f71
commit 677d812bbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

30
tron
View File

@ -1,3 +1,10 @@
--[[
TRON Light Cycle Game
programmed by LDDestroier
wget https://raw.githubusercontent.com/LDDestroier/CC/master/tron
--]]
local port = 701 local port = 701
local scr_x, scr_y = term.getSize() local scr_x, scr_y = term.getSize()
@ -489,14 +496,17 @@ local titleScreen = function()
local choice = makeMenu(2, scr_y - 4, { local choice = makeMenu(2, scr_y - 4, {
"Start Game", "Start Game",
"How to Play",
"Grid Demo", "Grid Demo",
"Exit" "Exit"
}) })
if choice == 1 then if choice == 1 then
return "start" return "start"
elseif choice == 2 then elseif choice == 2 then
return "demo" return "help"
elseif choice == 3 then elseif choice == 3 then
return "demo"
elseif choice == 4 then
return "exit" return "exit"
end end
end end
@ -734,6 +744,22 @@ local networking = function()
end end
end end
helpScreen = function()
term.setBackgroundColor(colors.black)
term.setTextColor(colors.white)
term.clear()
term.setCursorPos(1,2)
print([[
Move with arrow keys.
Pan the camera with WASD.
Hold SPACE to create gaps.
That's basically it.
Press any key to go back.
]])
waitForKey(0.25)
end
while true do while true do
decision = titleScreen() decision = titleScreen()
lockInput = false lockInput = false
@ -754,6 +780,8 @@ while true do
}) })
parallel.waitForAny(pleaseWait, networking) parallel.waitForAny(pleaseWait, networking)
parallel.waitForAny(getInput, game, networking) parallel.waitForAny(getInput, game, networking)
elseif decision == "help" then
helpScreen()
elseif decision == "demo" then elseif decision == "demo" then
parallel.waitForAny(getInput, gridDemo) parallel.waitForAny(getInput, gridDemo)
elseif decision == "exit" then elseif decision == "exit" then