Update tron

This commit is contained in:
LDDestroier 2018-11-16 10:36:19 -05:00 committed by GitHub
parent 2f450c6cab
commit cafe3c3005
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

10
tron
View File

@ -397,7 +397,10 @@ local doesIntersectBorder = function(x, y)
end
--draws grid and background at scroll 'x' and 'y', along with trails and players
local drawGrid = function(x, y, onlyDrawGrid)
local drawGrid = function(x, y, onlyDrawGrid, useSetVisible)
if useSetVisible then
tsv(false)
end
x, y = mathfloor(x + 0.5), mathfloor(y + 0.5)
local bg = {{},{},{}}
local foreX, foreY
@ -467,6 +470,9 @@ local drawGrid = function(x, y, onlyDrawGrid)
termsetCursorPos(1,sy)
termblit(bg[1][sy], bg[2][sy], bg[3][sy])
end
if useSetVisible then
tsv(true)
end
end
local render = function()
@ -587,7 +593,7 @@ local makeMenu = function(x, y, options, doAnimate)
end
elseif evt[1] == "timer" and evt[2] == gstID then
gstID = os.startTimer(0.05)
drawGrid(gsX, gsY, true)
drawGrid(gsX, gsY, true, true)
step = step + 1
if mathceil(step / 100) % 2 == 1 then
gsX = gsX + 1