1
0
mirror of https://github.com/LDDestroier/CC/ synced 2024-12-12 11:10:28 +00:00

Prettied it up

This commit is contained in:
LDDestroier 2019-01-20 14:23:18 -05:00 committed by GitHub
parent 9cd8f7da4b
commit b5f6f7cf7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,7 +16,11 @@ local maxFrame = 26 --max frames until new wall
local fframe = 0 -- not a typo. is the buffer of spaces until the spaces between walls shrinks
local maxFFrame = 6 -- max fframes until the space between walls gets slightly tighter (down to 5, good luck m8)
local pause = false -- pausing is a nice thing
local tsv = term.current().setVisible --it is my belief that monitors and normal computers do not have the setVisible method for term.current()
local tsv = function(visible) -- monitors don't have term.current().setVisible, damn you
if term.current().setVisible then
term.current().setVisible(visible)
end
end
for a = 1, scr_x do
table.insert(walls,{top=1,bottom=scr_y,color=colors.black})
end
@ -65,7 +69,7 @@ local trymove = function(dir)
end
local render = function()
if tsv then tsv(false) end
tsv(false)
term.setBackgroundColor(colors.white)
term.setTextColor(colors.white)
term.clear()
@ -78,11 +82,11 @@ local render = function()
term.clearLine()
for x = 1, #walls do
term.setBackgroundColor(walls[x].color)
for y = 1, walls[x].top do
for y = 2, walls[x].top do
term.setCursorPos(x,y)
term.write(" ")
end
for y = walls[x].bottom, scr_y do
for y = walls[x].bottom, scr_y - 1 do
term.setCursorPos(x,y)
term.write(" ")
end
@ -90,7 +94,7 @@ local render = function()
term.setCursorPos(2,1)
term.setBackgroundColor(colors.black)
term.write("SCORE: "..score.." | TIME: "..time)
if tsv then tsv(true) end
tsv(true)
end
local keepTime = function()
@ -147,7 +151,7 @@ local doGame = function()
end
render()
end
sleep(0)
sleep(0.05)
if guyY <= walls[guyX].top or guyY >= walls[guyX].bottom then
return "dead"
end
@ -169,7 +173,7 @@ local getInput = function()
"Paused. Press 'P' to resume",
"The game is paused",
"GAME PAUSE !",
"What, gotta catch your breath??",
"What, gotta catch your breath?",
"Paused, the game is, hmmm?",
"PAUSED GAME",
"GAME PAUSED",
@ -179,8 +183,6 @@ local getInput = function()
"UNPAUSE WITH 'P'",
"Tip: press UP to go up",
"Tip: press DOWN to go down",
"Tip: read Narbonic comic, you tool",
"Tip: read Skin Horse comic, you twat",
"YOU HAVE NO CHANCE TO SURVIVE MAKE YOUR TIME",
"-PAUSED-",
"=PAUSED=",