mirror of https://github.com/LDDestroier/CC/
Update tron.lua
This commit is contained in:
parent
a1093f5314
commit
5b895eda55
8
tron.lua
8
tron.lua
|
@ -12,6 +12,7 @@ local isColor = term.isColor()
|
||||||
-- lower value = faster game. I'd reccommend 0.1 for SMP play.
|
-- lower value = faster game. I'd reccommend 0.1 for SMP play.
|
||||||
local gameDelayInit = 0.1
|
local gameDelayInit = 0.1
|
||||||
local doDrawPlayerNames = false
|
local doDrawPlayerNames = false
|
||||||
|
local useSetVisible = true
|
||||||
|
|
||||||
local initGrid = {
|
local initGrid = {
|
||||||
x1 = -100,
|
x1 = -100,
|
||||||
|
@ -193,7 +194,7 @@ local termblit = function(char, text, back)
|
||||||
end
|
end
|
||||||
|
|
||||||
local tsv = function(visible)
|
local tsv = function(visible)
|
||||||
if term.current().setVisible then
|
if term.current().setVisible and useSetVisible then
|
||||||
term.current().setVisible(visible)
|
term.current().setVisible(visible)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -705,7 +706,9 @@ local makeMenu = function(x, y, options, doAnimate)
|
||||||
end
|
end
|
||||||
while true do
|
while true do
|
||||||
rend()
|
rend()
|
||||||
|
tsv(true)
|
||||||
evt = {os.pullEvent()}
|
evt = {os.pullEvent()}
|
||||||
|
tsv(false)
|
||||||
if evt[1] == "key" then
|
if evt[1] == "key" then
|
||||||
if evt[2] == keys.up then
|
if evt[2] == keys.up then
|
||||||
lastPos = cpos
|
lastPos = cpos
|
||||||
|
@ -720,11 +723,12 @@ local makeMenu = function(x, y, options, doAnimate)
|
||||||
lastPos = cpos
|
lastPos = cpos
|
||||||
cpos = #options
|
cpos = #options
|
||||||
elseif evt[2] == keys.enter then
|
elseif evt[2] == keys.enter then
|
||||||
|
tsv(true)
|
||||||
return cpos
|
return cpos
|
||||||
end
|
end
|
||||||
elseif evt[1] == "timer" and evt[2] == gstID then
|
elseif evt[1] == "timer" and evt[2] == gstID then
|
||||||
gstID = os.startTimer(gameDelayInit)
|
gstID = os.startTimer(gameDelayInit)
|
||||||
drawGrid(gsX, gsY, true, true)
|
drawGrid(gsX, gsY, true)
|
||||||
step = step + 1
|
step = step + 1
|
||||||
if mathceil(step / 100) % 2 == 1 then
|
if mathceil(step / 100) % 2 == 1 then
|
||||||
gsX = gsX + 1
|
gsX = gsX + 1
|
||||||
|
|
Loading…
Reference in New Issue