mirror of https://github.com/LDDestroier/CC/
Prettied it up
This commit is contained in:
parent
9cd8f7da4b
commit
b5f6f7cf7c
20
dodge.lua
20
dodge.lua
|
@ -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 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 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 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
|
for a = 1, scr_x do
|
||||||
table.insert(walls,{top=1,bottom=scr_y,color=colors.black})
|
table.insert(walls,{top=1,bottom=scr_y,color=colors.black})
|
||||||
end
|
end
|
||||||
|
@ -65,7 +69,7 @@ local trymove = function(dir)
|
||||||
end
|
end
|
||||||
|
|
||||||
local render = function()
|
local render = function()
|
||||||
if tsv then tsv(false) end
|
tsv(false)
|
||||||
term.setBackgroundColor(colors.white)
|
term.setBackgroundColor(colors.white)
|
||||||
term.setTextColor(colors.white)
|
term.setTextColor(colors.white)
|
||||||
term.clear()
|
term.clear()
|
||||||
|
@ -78,11 +82,11 @@ local render = function()
|
||||||
term.clearLine()
|
term.clearLine()
|
||||||
for x = 1, #walls do
|
for x = 1, #walls do
|
||||||
term.setBackgroundColor(walls[x].color)
|
term.setBackgroundColor(walls[x].color)
|
||||||
for y = 1, walls[x].top do
|
for y = 2, walls[x].top do
|
||||||
term.setCursorPos(x,y)
|
term.setCursorPos(x,y)
|
||||||
term.write(" ")
|
term.write(" ")
|
||||||
end
|
end
|
||||||
for y = walls[x].bottom, scr_y do
|
for y = walls[x].bottom, scr_y - 1 do
|
||||||
term.setCursorPos(x,y)
|
term.setCursorPos(x,y)
|
||||||
term.write(" ")
|
term.write(" ")
|
||||||
end
|
end
|
||||||
|
@ -90,7 +94,7 @@ local render = function()
|
||||||
term.setCursorPos(2,1)
|
term.setCursorPos(2,1)
|
||||||
term.setBackgroundColor(colors.black)
|
term.setBackgroundColor(colors.black)
|
||||||
term.write("SCORE: "..score.." | TIME: "..time)
|
term.write("SCORE: "..score.." | TIME: "..time)
|
||||||
if tsv then tsv(true) end
|
tsv(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
local keepTime = function()
|
local keepTime = function()
|
||||||
|
@ -147,7 +151,7 @@ local doGame = function()
|
||||||
end
|
end
|
||||||
render()
|
render()
|
||||||
end
|
end
|
||||||
sleep(0)
|
sleep(0.05)
|
||||||
if guyY <= walls[guyX].top or guyY >= walls[guyX].bottom then
|
if guyY <= walls[guyX].top or guyY >= walls[guyX].bottom then
|
||||||
return "dead"
|
return "dead"
|
||||||
end
|
end
|
||||||
|
@ -169,7 +173,7 @@ local getInput = function()
|
||||||
"Paused. Press 'P' to resume",
|
"Paused. Press 'P' to resume",
|
||||||
"The game is paused",
|
"The game is paused",
|
||||||
"GAME PAUSE !",
|
"GAME PAUSE !",
|
||||||
"What, gotta catch your breath??",
|
"What, gotta catch your breath?",
|
||||||
"Paused, the game is, hmmm?",
|
"Paused, the game is, hmmm?",
|
||||||
"PAUSED GAME",
|
"PAUSED GAME",
|
||||||
"GAME PAUSED",
|
"GAME PAUSED",
|
||||||
|
@ -179,8 +183,6 @@ local getInput = function()
|
||||||
"UNPAUSE WITH 'P'",
|
"UNPAUSE WITH 'P'",
|
||||||
"Tip: press UP to go up",
|
"Tip: press UP to go up",
|
||||||
"Tip: press DOWN to go down",
|
"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",
|
"YOU HAVE NO CHANCE TO SURVIVE MAKE YOUR TIME",
|
||||||
"-PAUSED-",
|
"-PAUSED-",
|
||||||
"=PAUSED=",
|
"=PAUSED=",
|
||||||
|
|
Loading…
Reference in New Issue