Add files via upload

This commit is contained in:
LDDestroier 2019-01-20 14:16:59 -05:00 committed by GitHub
parent cb1acd96a9
commit 9cd8f7da4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 2598 additions and 0 deletions

213
dodge.lua Normal file
View File

@ -0,0 +1,213 @@
--[[
Wall Dodge! What a riveting game!
Dodge the walls before they kill you.
Download with:
pastebin get fDTts7wz dodge
std PB fDTts7wz dodge
std ld dodge dodge
--]]
local scr_x, scr_y = term.getSize()
local keysDown = {} --holds all pressed keys. It's way better than using "key" event for movement
local walls = {} --holds all screen data for walls. I could do slants if I wanted, not just walls
local frame = 0 --for every screen update-oh, you know what a frame is
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()
for a = 1, scr_x do
table.insert(walls,{top=1,bottom=scr_y,color=colors.black})
end
local score = 0 --increases for every wall.
local time = 0 --in seconds, increases in increments of 0.1
local addNewWall = function(top,bottom,color)
table.remove(walls,1)
table.insert(walls,{top=top,bottom=bottom,color=color})
end
local guyX = 2
local guyY = math.floor(scr_y/2)
local maxY = scr_y-1
local minY = 2
local clearLines = function(y1,y2)
local _x,_y = term.getCursorPos()
for a = y1, y2 or y1 do
term.setCursorPos(1,a)
term.clearLine()
end
term.setCursorPos(_x,_y)
end
local renderTEXT = function(_txt)
local txt = _txt or "YOU ARE DEAD"
local midY = math.floor(scr_y/2)
for a = 0, 2 do
term.setBackgroundColor(colors.gray)
clearLines(midY-a,midY+a)
sleep(0.1)
end
term.setCursorPos(4,midY)
term.write(txt)
end
local trymove = function(dir)
if (guyY+dir)>=minY and (guyY+dir)<=maxY then
guyY = guyY + dir
return true
end
return false
end
local render = function()
if tsv then tsv(false) end
term.setBackgroundColor(colors.white)
term.setTextColor(colors.white)
term.clear()
term.setCursorPos(guyX,guyY)
term.setBackgroundColor(colors.black)
term.write(" ")
term.setCursorPos(1,1)
term.clearLine()
term.setCursorPos(1,scr_y)
term.clearLine()
for x = 1, #walls do
term.setBackgroundColor(walls[x].color)
for y = 1, walls[x].top do
term.setCursorPos(x,y)
term.write(" ")
end
for y = walls[x].bottom, scr_y do
term.setCursorPos(x,y)
term.write(" ")
end
end
term.setCursorPos(2,1)
term.setBackgroundColor(colors.black)
term.write("SCORE: "..score.." | TIME: "..time)
if tsv then tsv(true) end
end
local keepTime = function()
time = 0
while true do
sleep(0.1)
if not pause then
time = time + 0.1
end
end
end
local doGame = function()
local wf = 0
local gap = 2
local ypos, randomcol
while true do
if not pause then
if frame >= maxFrame or wf > 0 then
if frame >= maxFrame then
frame = 0
fframe = fframe + 1
ypos = math.random(4,scr_y-3)
wf = 3
randomcol = 2^math.random(1,14)
end
if wf > 0 then
wf = wf - 1
end
if not term.isColor() then
randomcol = colors.black --Shame.
end
addNewWall(ypos-gap,ypos+gap,randomcol)
else
frame = frame + 1
addNewWall(1,scr_y,colors.black)
end
if fframe >= maxFFrame then
fframe = 0
if maxFrame > 7 then
maxFrame = maxFrame - 1
end
end
if keysDown[keys.up] then
trymove(-1)
end
if keysDown[keys.down] then
trymove(1)
end
if walls[guyX-1].top > 1 or walls[guyX-1].bottom < scr_y then
if walls[guyX].top < walls[guyX-1].top or walls[guyX].bottom > walls[guyX-1].bottom then
score = score + 1
end
end
render()
end
sleep(0)
if guyY<=walls[guyX].top or guyY>=walls[guyX].bottom then
return "dead"
end
end
end
local getInput = function()
while true do
local evt = {os.pullEvent()}
if evt[1] == "key" then
if evt[2] == keys.q then
return "quit"
end
if evt[2] == keys.p then
pause = not pause
if pause then
local pauseMSGs = {
"PAUSED",
"Paused. Press 'P' to resume",
"The game is paused",
"GAME PAUSE !",
"What, gotta catch your breath??",
"Paused, the game is, hmmm?",
"PAUSED GAME",
"GAME PAUSED",
"THE GAME IS PAUSED",
"THE PAUSED IS GAME",
"Buh-buh-buh-BEEP",
"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=",
"PAISED",
"THOUST GAME BE PAUSETH",
"Yon game is paused. Obvious exits are 'Q', 'CTRL+T'",
"Tip: don't hit the walls",
"Tip: press 'P' to pause the game",
}
renderTEXT(pauseMSGs[math.random(1,#pauseMSGs)])
keysDown[keys.up] = false
keysDown[keys.down] = false
end
end
keysDown[evt[2]] = true
end
if evt[1] == "key_up" then
keysDown[evt[2]] = false
end
end
end
local uut = parallel.waitForAny(getInput,doGame,keepTime)
if uut == 2 then
renderTEXT()
end
sleep(0.05)
term.setCursorPos(1,scr_y)
term.setBackgroundColor(colors.black)
term.clearLine()

207
drawtoy.lua Normal file
View File

@ -0,0 +1,207 @@
--[[
pastebin get tfyqv2ww toy
std pb tfyqv2ww toy
--]]
local channel = 180
local modem
local scr_x, scr_y = term.getSize()
local valchar = "#" --character used for fading
local hedchar = "@" --character used for tip of line
local s = { --default color combinations
[1] = { --A classical black-and-white color fade, perfect for looking classy and pretentious.
colors.black,
colors.gray,
colors.lightGray,
colors.white,
},
[2] = { --If you're feeling blue, then this randomly selected set of four colors should make you feel even worse!
colors.black,
colors.blue,
colors.cyan,
colors.lightBlue,
},
[3] = { --This one's purple. Tha-that's it. Like purple? Good.
colors.black,
colors.red,
colors.magenta,
colors.pink,
},
[4] = { --I'll admit, the creativity is lacking in this color. I mean, what was I thinking?
colors.black,
colors.gray,
colors.green,
colors.lime,
},
[5] = { --NOBODY CALLS ME YELLOW
colors.black,
colors.brown,
colors.orange,
colors.yellow,
},
}
local p = math.random(1,#s)
local g = function(num,sa) --This interprets the color palate and turns it into a fadey thing.
if not sa then sa = s[p] end
local values = {
[1] = {bg=sa[1], txt=sa[1], char=valchar},
[2] = {bg=sa[1], txt=sa[2], char=valchar},
[3] = {bg=sa[2], txt=sa[1], char=valchar},
[4] = {bg=sa[2], txt=sa[2], char=valchar},
[5] = {bg=sa[3], txt=sa[2], char=valchar},
[6] = {bg=sa[3], txt=sa[3], char=valchar},
[7] = {bg=sa[3], txt=sa[4], char=valchar},
[8] = {bg=sa[4], txt=sa[3], char=valchar},
[9] = {bg=sa[4], txt=sa[4], char=hedchar},
}
if not num then return #values end
return values[num]
end
local size = g()
local grid = {}
local ah = {}
for b = 1, scr_x do
ah[b] = {v = 0, r = s[p]}
end
for b = 1, scr_y do
grid[b] = ah
end
local between = function(num,min,max)
return (num > min and num or min) < max and num or max
end
local getDotsInLine = function( startX, startY, endX, endY ) --graciously stolen from the paintutils, and PAIN
local out = {}
startX = math.floor(startX)
startY = math.floor(startY)
endX = math.floor(endX)
endY = math.floor(endY)
if startX == endX and startY == endY then
out = {{x=startX,y=startY}}
return out
end
local minX = math.min( startX, endX )
if minX == startX then
minY = startY
maxX = endX
maxY = endY
else
minY = endY
maxX = startX
maxY = startY
end
local xDiff = maxX - minX
local yDiff = maxY - minY
if xDiff > math.abs(yDiff) then
local y = minY
local dy = yDiff / xDiff
for x=minX,maxX do
table.insert(out,{x=x,y=math.floor(y+0.5)})
y = y + dy
end
else
local x = minX
local dx = xDiff / yDiff
if maxY >= minY then
for y=minY,maxY do
table.insert(out,{x=math.floor(x+0.5),y=y})
x = x + dx
end
else
for y=minY,maxY,-1 do
table.insert(out,{x=math.floor(x+0.5),y=y})
x = x - dx
end
end
end
return out
end
local getModemInput = function()
while true do
local _,side,freq,rfreq,msg,dist = os.pullEvent("modem_message")
if freq == channel then
if type(msg) == "table" then
if type(msg.x) == "number" and type(msg.y) == "number" and type(msg.r) == "table" then
if (msg.x >= 1 and msg.x <= scr_x) and (msg.y >= 1 and msg.y <= scr_y) and (#msg.r == 4) then
grid[msg.y][msg.x] = {v = size, r = msg.r}
end
end
end
end
end
end
local render = function(grid)
local q
for y = 1, #grid do
for x = 1, #grid[y] do
q = grid[y][x]
if q then
term.setCursorPos(x,y)
term.setTextColor(g( between( q.v+1, 1, size ), q.r ).txt )
term.setBackgroundColor(g( between(q.v+1,1,size), q.r ).bg )
term.write(g(between(q.v+1,1,size),q.r).char)
end
end
end
end
local downByOne = function(grid)
local output = {}
for y = 1, #grid do
output[y] = {}
for x = 1, #grid[y] do
output[y][x] = {}
if grid[y][x].v > 0 then
output[y][x].v = grid[y][x].v - 1
else
output[y][x].v = 0
end
output[y][x].r = grid[y][x].r
end
end
return output
end
local getInput = function()
local mx,my,oldx,oldy,dots
while true do
local evt = {os.pullEvent()}
modem = peripheral.find("modem")
if modem then modem.open(channel) end
if evt[1] == "key" then
if evt[2] == keys.q then
sleep(0)
return
end
elseif evt[1] == "mouse_click" or evt[1] == "mouse_drag" then
oldx,oldy = mx or evt[3],my or evt[4]
mx,my = evt[3],evt[4]
dots = getDotsInLine(oldx,oldy,mx,my)
for a = 1, #dots do
grid[dots[a].y][dots[a].x] = {v = size, r = s[p]}
if modem then
modem.transmit(channel,channel,{x=dots[a].x, y=dots[a].y, r=s[p]})
end
end
elseif evt[1] == "mouse_up" then
mx,my = nil,nil
end
end
end
local dothRendering = function()
local t = false --term.current().setVisible
while true do
if t then t(false) end
render(grid)
if t then t(true) end
grid = downByOne(grid)
sleep(0)
end
end
local funclist = {
getInput,
dothRendering,
getModemInput,
}
parallel.waitForAny(unpack(funclist))

448
progdor.lua Normal file
View File

@ -0,0 +1,448 @@
--[[
PROGDOR file bundling program
Download with:
pastebin get YXx5jjMV progdor
std ld progdor progdor
This is a stable release. You fool!
--]]
local doCompress = false --even if this is false, it will decompress compressed files. nifty, huh?
local doPastebin = false
local tArg = {...}
local input, outpath
if tArg[1] == "-p" then --the p is for pastebin
doPastebin = true
input = tArg[2]
outpath = tArg[3]
else
input = tArg[1]
outpath = tArg[2]
end
local progdor = fs.getName(shell.getRunningProgram())
local dir = shell.dir()
local displayHelp = function()
local txt = progdor.." <input> [output]\nCompression is "..tostring(doCompress):upper().."."
return print(txt)
end
local yield = function()
os.queueEvent("yield")
os.pullEvent("yield")
end
-- CCA API START --
local bit = bit32
local function pack(bn1, bn2)
return bit.band(bn1, 0xFF), bit.rshift(bn1, 8) + bit.lshift(bit.band(bn2, 0xF), 4), bit.rshift(bn2, 4)
end
local function upack(b1, b2, b3)
return (b1 + bit.lshift(bit.band(b2, 0xF), 8)), (bit.lshift(b3,4) + bit.band(bit.rshift(b2, 4), 0xF))
end
local function createDict(bool)
local ret = {}
for i = 1, 255 do
if bool then
ret[string.char(i)] = i
else
ret[i] = string.char(i)
end
end
if not bool then ret[256] = 256 end
return ret
end
local function cp(sInput)
local dic = createDict(true)
local s = ""
local ch
local dlen = 256
local result = {}
local temp
for i = 1, #sInput do
if dlen == 4095 then
result[#result + 1] = dic[s]
result[#result + 1] = 256
dic = createDict(true)
dlen = 256
s = ""
end
ch = sInput:sub(i, i)
temp = s..ch
if dic[temp] then
s = temp
else
result[#result + 1] = dic[s]
dlen = dlen +1
dic[temp] = dlen
s = ch
end
end
result[#result + 1] = dic[s]
return result
end
local function dc(data)
local dic = createDict(false)
local entry
local ch
local currCode
local result = {}
result[#result + 1] = dic[data[1]]
prefix = dic[data[1]]
for i = 2, #data do
currCode = data[i]
if currCode == 256 then
dic = createDict(false)
prefix = ""
else
entry = dic[currCode]
if entry then--exists in dictionary
ch = entry:sub(1, 1)
result[#result + 1] = entry
if prefix ~= "" then
dic[#dic+1] = prefix .. ch
end
else
ch = prefix:sub(1, 1)
result[#result + 1] = prefix..ch
dic[#dic + 1] = prefix..ch
end
prefix = dic[currCode]
end
end
return table.concat(result)
end
local function trim(inp)
for i = 0,2 do
if inp[#inp] == 0 then
inp[#inp] = nil
end
end
end
local function decompress(input)
local rec = {}
for i = 1, #input, 3 do
if i % 66 == 0 then
yield()
end
rec[#rec+1], rec[#rec+2] = upack(input[i], input[i+1] or 0, input[i+2] or 0)
end
trim(rec)
return dc(rec)
end
local function compress(input)
local rec = {}
local data = cp(input)
for i=1, #data, 2 do
yield()
rec[#rec+1], rec[#rec+2], rec[#rec+3] = pack(data[i], data[i+1] or 0)
end
trim(rec)
return rec
end
-- CCA API END --
local fixstr = function(str)
return str:gsub("\\(%d%d%d)",string.char)
end
local explode = function(div,str)
if (div=='') then return false end
local pos,arr = 0,{}
for st,sp in function() return string.find(str,div,pos,true) end do
table.insert(arr,str:sub(pos,st-1))
pos = sp + 1
end
table.insert(arr,str:sub(pos))
return arr
end
local sanitize = function(sani,tize)
local _,x = string.find(sani,tize)
if x then
return sani:sub(x+1)
else
return sani
end
end
local tablize = function(input)
if type(input) == "string" then
return explode("\n",input)
elseif type(input) == "table" then
return table.concat(input,"\n")
end
end
local compyress = function(input)
return string.char(unpack(compress(input)))
end
local decompyress = function(input)
local out = {}
for a = 1, #input do
table.insert(out,string.byte(input:sub(a,a)))
end
return decompress(out)
end
local listAll
listAll = function(_path, _files, noredundant)
local path = _path or ""
local files = _files or {}
if #path > 1 then table.insert(files, path) end
for _, file in ipairs(fs.list(path)) do
local path = fs.combine(path, file)
if (file ~= thisProgram) then
local guud = true
if guud then
if fs.isDir(path) then
listAll(path, files, noredundant)
else
table.insert(files, path)
end
end
end
end
if noredundant then
for a = 1, #files do
if fs.isDir(tostring(files[a])) then
if #fs.list(tostring(files[a])) ~= 0 then
table.remove(files,a)
end
end
end
end
return files
end
if not (input) then
return displayHelp()
end
if not outpath then
outpath = input
end
local choice = function(input,verbose)
if not input then
input = "yn"
end
if verbose then
write("[")
for a = 1, #input do
write(input:sub(a,a):upper())
if a < #input then
write(",")
end
end
write("]?")
end
local evt,char
repeat
evt,char = os.pullEvent("char")
until string.find(input:lower(),char:lower())
if verbose then
print(char:upper())
end
local pos = string.find(input:lower(),char:lower())
return pos, char:lower()
end
local postToPastebin = function(name, contents)
local key = "0ec2eb25b6166c0c27a394ae118ad829"
local response = http.post(
"http://pastebin.com/api/api_post.php",
"api_option=paste&"..
"api_dev_key="..key.."&"..
"api_paste_format=lua&"..
"api_paste_name="..textutils.urlEncode(name).."&"..
"api_paste_code="..textutils.urlEncode(contents)
)
if response then
local sResponse = response.readAll()
response.close()
local sCode = string.match( sResponse, "[^/]+$" )
return sCode
else
return false
end
return
end
function doPack(input,output,doCompress,verbose) --make sure that shell exists before using verbose mode
local tx = term.getTextColor()
if not doPastebin then
if not fs.exists(input) then return 3 end
if fs.isReadOnly(output) then return 5 end
end
local packageSelf = true
local packageReadOnly = true
local ro_asked = false
local ps_asked = false
if fs.isDir(input) then --if not a package
local out = {}
local list = listAll(input,nil,true)
if verbose then
for a = 1, #list do --this checks for self and read-only files
if fs.isReadOnly(list[a]) and (not ro_asked) then
write("Include read-only files? ")
if choice("yn",true) == 2 then
packageReadOnly = false
end
ro_asked = true
end
if fs.combine("",list[a]) == shell.getRunningProgram() and (not ps_asked) then
write("Include self? ")
if choice("yn",true) == 2 then
packageSelf = false
end
ps_asked = true
end
end
end
for a = 1, #list do --this loop kills fascists
local is_self = fs.combine("",list[a]) == fs.combine("",shell.getRunningProgram())
if not ((is_self and not packageSelf) or (fs.isReadOnly(list[a]) and not packageReadOnly)) then
if verbose then
write("[")
if term.isColor() then term.setTextColor(colors.lightGray) end
write(sanitize(list[a],fs.combine(dir,input)))
term.setTextColor(tx)
write("]")
end
if fs.isDir(list[a]) then
out[sanitize(list[a],fs.combine(dir,input))] = true
else
local file = fs.open(list[a],"r")
local cont = file.readAll()
file.close()
if doCompress then
out[sanitize(list[a],fs.combine(dir,input))] = tablize(compyress(cont))
else
out[sanitize(list[a],fs.combine(dir,input))] = tablize(cont)
end
end
local tx = term.getTextColor()
if fs.getName(list[a]):lower() == "peasant" then
if term.isColor() then
term.setTextColor(colors.orange)
end
print(" BURNINATED")
else
if term.isColor() then
term.setTextColor(colors.green)
end
print(" GOOD")
end
term.setTextColor(tx)
else
if fs.getName(list[a]):lower() == "peasant" then
print("Spared "..list[a])
else
print("Skipped "..list[a])
end
end
end
local fullOutput = tostring(doCompress).."\n"..fixstr(textutils.serialize(out))
local sCode
if doPastebin then
print("Uploading...")
sCode = postToPastebin(input,fullOutput)
return 7, "Code = '"..sCode.."'"
else
if fs.isDir(output) then fs.delete(output) end
local file = fs.open(output,"w")
file.write(fullOutput)
file.close()
return 1
end
else --if a package
local list, isCompy
if not doPastebin then
local file = fs.open(input,"r")
isCompy = file.readLine()
list = file.readAll()
file.close()
else
local file = http.get("http://pastebin.com/raw/"..tostring(input))
if file then
isCompy = file.readLine()
list = file.readAll()
else
return 6
end
end
local list = textutils.unserialize(list)
if type(list) ~= "table" then
return 4
end
if fs.exists(output) then
fs.delete(output)
end
local amnt = 0
for k,v in pairs(list) do
amnt = amnt + 1
end
local num = 0
for k,v in pairs(list) do
num = num + 1
if v == true then
fs.makeDir(fs.combine(output,fs.combine(k,dir)))
else
local file = fs.open(fs.combine(output,fs.combine(k,dir)),"w")
if verbose then
write("[")
if term.isColor() then term.setTextColor(colors.lightGray) end
write(k)
term.setTextColor(tx)
write("]")
end
if isCompy:gsub(" ","") == "true" then
file.write(decompyress(tablize(v)))
else
file.write(tablize(v))
end
file.close()
local tx = term.getTextColor()
if fs.getName(k):lower() == "peasant" then
if term.isColor() then
term.setTextColor(colors.orange)
end
print(" UNBURNINATED")
else
if term.isColor() then
term.setTextColor(colors.green)
end
print(" GOOD")
end
term.setTextColor(tx)
end
end
return 2
end
end
local success, res, otherRes = pcall( function() return doPack(input,outpath,doCompress,true) end ) --functionized it!
if not success then
term.setTextColor(colors.white)
print("\n***Something went wrong!***")
return printError(res)
end
if res then
local msgs = {
[1] = "Successfully packed '"..input.."/' as '"..outpath.."'",
[2] = "Successfully unpacked '"..input.."' to '"..outpath.."/'",
[3] = "That file/folder does not exist.",
[4] = "That file isn't a packed folder.",
[5] = "You don't have permission.",
[6] = "Failed to connect.",
[7] = "Uploaded successfully.",
}
print(msgs[res])
if otherRes then
print(otherRes)
end
end

288
quickdraw.lua Normal file
View File

@ -0,0 +1,288 @@
--[[
QuickDraw!
Can you outshoot the cowbow?
I bet you can! It's actually really easy...
pastebin get uGTzMxNL quickdraw
std pb uGTzMxNL quickdraw
std ld quickdraw
--]]
local difficulty = 1.2 --amount of time you have to shoot im'
local isRunning = true --whether the game should loop
local over = false --whether you or the guy is dead
local wins = 0
local losses = 0
local s = {
enemy = {
getready = {{},{},{0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,},{0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,},{0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,16,},{0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,16,},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,},{0,0,0,0,0,0,0,0,0,0,0,0,4096,4096,128,4096,4096,4096,4096,},{0,0,0,0,0,0,0,0,0,0,0,4096,0,4096,128,4096,4096,0,4096,},{0,0,0,0,0,0,0,0,0,0,0,4096,0,4096,128,4096,4096,0,4096,},{0,0,0,0,0,0,0,0,0,0,0,4096,0,4096,128,4096,4096,0,4096,},{0,0,0,0,0,0,0,0,0,0,0,0,256,4096,128,4096,4096,4096,},{0,0,0,0,0,0,0,0,0,0,0,0,0,2048,2048,2048,2048,},{0,0,0,0,0,0,0,0,0,0,0,0,0,2048,0,2048,2048,},{0,0,0,0,0,0,0,0,0,0,0,0,0,2048,0,0,2048,},{0,0,0,0,0,0,0,0,0,0,0,0,0,2048,0,0,2048,},{0,0,0,0,0,0,0,0,0,0,0,0,0,2048,0,0,2048,},},
shoot1 = {{},{},{0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,},{0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,},{0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,16,},{0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,16,},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,},{0,0,0,0,0,0,0,0,0,0,0,0,0,4096,128,4096,4096,},{0,0,0,0,0,0,0,0,0,0,0,0,4096,4096,128,4096,4096,4096,},{0,0,0,0,0,0,0,0,0,0,0,4096,0,4096,4096,128,4096,4096,},{0,0,0,0,0,0,0,0,0,0,0,256,0,4096,4096,128,4096,4096,},{0,0,0,0,0,0,0,0,0,0,0,0,0,4096,4096,128,4096,},{0,0,0,0,0,0,0,0,0,0,0,0,0,2048,2048,2048,2048,},{0,0,0,0,0,0,0,0,0,0,0,0,0,2048,2048,2048,2048,},{0,0,0,0,0,0,0,0,0,0,0,0,0,2048,0,0,2048,},{0,0,0,0,0,0,0,0,0,0,0,0,0,2048,0,0,2048,},{0,0,0,0,0,0,0,0,0,0,0,0,0,2048,0,0,2048,},},
shoot2 = {{},{},{0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,},{0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,},{0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,16,},{0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,16,},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,},{0,0,0,0,0,0,0,0,0,0,0,0,256,4096,4096,128,4096,},{0,0,0,0,0,0,0,0,0,0,0,0,4096,4096,4096,128,4096,4096,},{0,0,0,0,0,0,0,0,0,0,0,0,0,4096,4096,128,4096,0,4096,},{0,0,0,0,0,0,0,0,0,0,0,0,0,4096,4096,128,4096,0,4096,},{0,0,0,0,0,0,0,0,0,0,0,0,0,4096,4096,128,4096,},{0,0,0,0,0,0,0,0,0,0,0,0,0,2048,2048,2048,2048,},{0,0,0,0,0,0,0,0,0,0,0,0,0,2048,2048,0,2048,},{0,0,0,0,0,0,0,0,0,0,0,0,0,2048,0,0,2048,},{0,0,0,0,0,0,0,0,0,0,0,0,0,2048,0,0,2048,},{0,0,0,0,0,0,0,0,0,0,0,0,0,2048,0,0,2048,},},
laugh = {{},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,},{0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,0,0,0,0,1,1,32768,1,1,32768,1,1,32768,32768,1,1,32768,1,1,},{0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,16,0,0,0,1,1,1,1,32768,1,1,32768,1,32768,1,1,32768,1,32768,1,1,},{0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,16,16,0,1,1,1,1,1,1,32768,32768,32768,32768,1,32768,32768,32768,32768,1,32768,1,1,},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16,0,0,0,0,1,1,1,1,32768,1,1,32768,1,32768,1,1,32768,1,1,1,1,},{0,0,0,0,0,0,0,0,0,0,0,0,0,4096,4096,128,4096,0,0,0,0,0,1,1,32768,1,1,32768,1,32768,1,1,32768,1,32768,1,1,},{0,0,0,0,0,0,0,0,0,0,0,0,4096,4096,4096,128,4096,4096,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{0,0,0,0,0,0,0,0,0,0,0,4096,0,4096,4096,128,4096,0,4096,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,},{0,0,0,0,0,0,0,0,0,0,0,4096,0,4096,4096,128,4096,0,4096,},{0,0,0,0,0,0,0,0,0,0,0,0,4096,4096,4096,128,4096,4096,},{0,0,0,0,0,0,0,0,0,0,0,0,0,2048,2048,2048,2048,},{0,0,0,0,0,0,0,0,0,0,0,0,0,2048,2048,0,2048,},{0,0,0,0,0,0,0,0,0,0,0,0,0,2048,0,0,2048,},{0,0,0,0,0,0,0,0,0,0,0,0,0,2048,0,0,2048,},{0,0,0,0,0,0,0,0,0,0,0,0,0,2048,0,0,2048,},},
dead = {{},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,},{0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,2,2,0,0,0,0,1,1,1,32768,32768,1,1,32768,1,32768,1,32768,1,1,1,},{0,0,0,0,0,0,0,0,0,0,0,4096,0,16,16,16,16,0,4096,0,1,1,1,1,32768,1,1,32768,1,32768,1,32768,1,32768,1,1,1,},{0,0,0,0,0,0,0,0,0,0,0,4096,0,16,16,16,16,0,1,1,1,1,1,1,32768,32768,32768,32768,1,32768,32768,32768,1,32768,1,1,1,},{0,0,0,0,0,0,0,0,0,0,0,4096,0,0,16,16,0,0,4096,0,1,1,1,1,32768,1,1,32768,1,32768,1,32768,1,1,1,1,1,},{0,0,0,0,0,0,0,0,0,0,0,4096,0,4096,4096,128,4096,0,4096,0,0,0,1,1,32768,1,1,32768,1,32768,1,32768,1,32768,1,1,1,},{0,0,0,0,0,0,0,0,0,0,0,0,4096,4096,4096,128,4096,4096,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,},{0,0,0,0,0,0,0,0,0,0,0,0,0,4096,4096,128,4096,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,},{0,0,0,0,0,0,0,0,0,0,0,0,0,4096,4096,128,4096,},{0,0,0,0,0,0,0,0,0,0,0,0,0,4096,4096,128,4096,},{0,0,0,0,0,0,0,0,0,0,0,0,0,2048,2048,2048,2048,},{0,0,0,0,0,0,0,0,0,0,0,0,0,2048,2048,0,2048,},{0,0,0,0,0,0,0,0,0,0,0,0,0,2048,0,0,2048,},{0,0,0,0,0,0,0,0,0,0,0,0,0,2048,0,0,2048,},{0,0,0,0,0,0,0,0,0,0,0,0,0,2048,0,0,2048,},},
},
bg = {{8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,},{8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,},{8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,},{8,8,8,8,8,1,1,1,1,8,8,8,1,1,8,8,8,8,8,8,8,8,8,8,8,8,8,1,1,1,1,1,1,8,8,8,8,8,8,8,8,8,8,16,16,8,8,8,8,8,8,},{8,8,8,1,1,1,1,1,1,1,1,1,1,1,1,1,8,8,8,8,8,8,8,8,8,1,1,1,1,1,1,1,1,1,8,8,8,8,8,8,8,8,16,16,16,16,8,8,8,8,8,},{8,8,8,1,1,1,1,1,1,1,1,1,1,1,1,1,8,8,8,8,8,8,8,8,8,1,1,1,1,1,1,1,1,1,8,8,8,8,8,8,8,8,8,16,16,8,8,8,8,8,8,},{8,8,8,1,1,1,1,1,1,1,1,1,1,1,1,8,8,8,8,8,8,8,8,8,8,8,8,1,1,8,1,1,1,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,},{8,8,8,8,8,1,1,1,8,8,8,1,1,1,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,},{8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,},{8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,},{8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,},{8,8,8,8,8,128,128,128,128,128,128,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,},{8,8,8,8,8,128,128,128,128,128,128,128,128,128,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,16,16,16,16,16,16,16,16,16,16,},{16,16,16,16,16,128,128,128,128,128,128,128,128,128,16,16,16,16,16,16,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,},{16,16,16,16,16,128,128,128,128,128,128,128,128,128,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,},{16,16,16,16,16,128,128,128,128,128,128,128,128,128,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,},{256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,},{256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,256,},{16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,},},
}
_s = s
local scr_x, scr_y = term.getSize()
local yield = function()
os.queueEvent("yield")
os.pullEvent("yield")
end
local RPGslowprint = function(text,rate)
local cX,cY = term.getCursorPos()
yield()
local uutcome = parallel.waitForAny(function()
textutils.slowPrint(text,rate or 20)
end, function()
os.pullEvent("key")
end)
if uutcome == 2 then
term.setCursorPos(cX,cY)
print(text)
end
end
local displayHelp = function(cli)
local helptext = [[
QuickDraw by EldidiStroyrr
HOW TO PLAY:
1) Click and hold on the green square for three seconds.
2) As soon as it says DRAW, quickly move your mouse over the guy and let go.
3) If you win, it'll get slightly harder
Press 'Q' to quit ingame.
]]
if cli then
print(helptext)
else
term.setBackgroundColor(colors.gray)
term.setTextColor(colors.white)
term.setCursorPos(1,2)
term.clear()
RPGslowprint(helptext,30)
term.setCursorPos(2,scr_y-1)
term.write("Press any key to continue!")
yield()
os.pullEvent("key")
end
end
function mixImages( img1, img2 )
local output = { }
for a = 1, #img2 do
output[ a ] = { }
if not img1[ a ] then
for b = 1, #img2[ a ] do
output[ a ][ b ] = img2[ a ][ b ]
end
else
for b = 1, #img2[ a ] do
if img1[ a ][ b ] then
if img1[ a ][ b ] ~= 0 then
output[ a ][ b ] = img1[ a ][ b ]
else
output[ a ][ b ] = img2[ a ][ b ]
end
else
output[ a ][ b ] = img2[ a ][ b ]
end
end
end
end
return output
end
local function clear()
local b,t = term.getBackgroundColor(), term.getTextColor()
term.setBackgroundColor(colors.black)
term.clear()
term.setBackgroundColor(b)
end
local function cprint(txt)
local pX, pY = term.getCursorPos()
term.setCursorPos((scr_x/2)-math.floor(#txt/2),(scr_y/2)+4)
term.write(txt)
term.setCursorPos(pX,pY)
end
local gameArea, alive
local function handleShooting()
currentSprite = "getready"
sleep(difficulty/4)
paintutils.drawImage(mixImages(s.enemy.shoot1,s.bg),1,1)
currentSprite = "shoot1"
sleep(difficulty/4)
paintutils.drawImage(mixImages(s.enemy.shoot2,s.bg),1,1)
currentSprite = "shoot2"
sleep(difficulty/2)
os.queueEvent("thoseWhoDig",false)
return false, "dead"
end
function drawHitBox(color)
paintutils.drawFilledBox(scr_x-3,scr_y-2,scr_x,scr_y,color)
term.setBackgroundColor(colors.lightBlue)
term.setTextColor(colors.white)
local txt = "YOU: "..wins.." / ENEMY: "..losses
term.setCursorPos(scr_x-(#txt+1)+1,1)
term.write(txt)
term.setBackgroundColor(colors.lightGray)
term.setTextColor(colors.gray)
local txt = "TIME: "..tostring(difficulty):sub(1,5).." SEC"
term.setCursorPos(2,scr_y-1)
term.write(txt)
end
function exitGame()
if not isRunning then
term.setCursorPos(1,scr_y)
term.setBackgroundColor(colors.black)
term.write(string.rep(" ",scr_x-4))
term.setCursorPos(1,scr_y)
sleep(0)
end
error()
end
currentSprite = "getready"
local function countdown()
term.setCursorPos((scr_x/2)-2,scr_y/2)
term.setTextColor(colors.black)
term.setBackgroundColor(colors.lightBlue)
cprint("3...")
sleep(0.8)
cprint("2...")
sleep(0.8)
cprint("1...")
sleep(0.8)
cprint("DRAW!")
end
function getInput()
alive = true
os.pullEvent("getMeSomeInput")
while true do
local evt
if gameArea == "beginning1" then
evt = {os.pullEvent()}
if evt[1] == "mouse_click" then
if evt[3] >= scr_x-3 and evt[4] >= scr_y-2 then
local res = parallel.waitForAny(function()
while true do
local evt = {os.pullEvent()}
if evt[1] == "mouse_up" or evt[1] == "mouse_click" then
break
elseif evt[1] == "mouse_drag" then
if (evt[3] < scr_x-3) or (evt[4] < scr_y-2) then
break
end
end
end
end, countdown)
if (res == 1) and not over then
cprint("FOUL!!")
exitGame()
end
os.queueEvent("imready")
parallel.waitForAny(function()
while alive do
evt = {os.pullEvent()}
if evt[1] == "mouse_up" then
local x,y = evt[3],evt[4]
if _s.enemy[currentSprite][y] then
if _s.enemy[currentSprite][y][x] then
if _s.enemy[currentSprite][y][x] ~= 0 then
os.queueEvent("thoseWhoDig",true,x,y)
break
end
end
end
sleep(0.2)
elseif evt[1] == "mouse_click" then --yay for anticheating
sleep(1)
end
end
end, handleShooting)
end
elseif evt[1] == "key" then
if evt[2] == keys.q then
isRunning = false
exitGame()
end
end
end
end
end
local flash = {
colors.white,
colors.lightGray,
colors.black,
colors.gray,
}
local tArg = {...}
if tArg[1] == "help" then
return displayHelp(true)
end
function game()
over = false
term.setTextColor(colors.white)
while true do
gameArea = "beginning1"
paintutils.drawImage(mixImages(s.enemy.getready,s.bg),1,1)
drawHitBox(colors.green)
currentSprite = "getready"
os.queueEvent("getMeSomeInput")
os.pullEvent("imready")
os.queueEvent("shootStart!")
local _,alive,x,y = os.pullEvent("thoseWhoDig")
over = true
if not alive then
for a = 1, #flash do
term.setBackgroundColor(flash[a])
term.clear()
sleep(0.1)
end
losses = losses + 1
paintutils.drawImage(mixImages(s.enemy.laugh,s.bg),1,1)
term.setTextColor(colors.red)
term.setBackgroundColor(colors.lightBlue)
sleep(0.5)
exitGame()
else
paintutils.drawImage(mixImages(s.enemy.dead,s.bg),1,1)
paintutils.drawPixel(x,y,colors.red)
sleep(0.2)
term.setBackgroundColor(colors.lightBlue)
term.setTextColor(colors.black)
cprint("YOU WIN!")
wins = wins + 1
sleep(0.8)
difficulty = difficulty * 0.92
exitGame()
end
end
end
clear()
displayHelp(false)
while isRunning do
parallel.waitForAny(getInput,game)
if isRunning then
sleep(0.8)
end
end

214
sdodge.lua Normal file
View File

@ -0,0 +1,214 @@
--[[
SUPER Dodge!!
A remake of that last game I made. Mostly an experiment with cool background.
Get with
pastebin get 5BUnGkUJ dodge2
And soon
std ld dodge2 dodge2
This game isn't finished, but it is certainly playable.
...you fool!
--]]
local scr_x, scr_y = term.getSize()
local sprite = {}
sprite.dw = {{128,128,128,128,128,128,},{128,256,256,256,256,128,},{128,256,256,256,256,128,},{128,256,256,256,256,128,},{128,256,256,256,256,128,},{128,256,256,256,256,128,},{128,256,256,256,256,128,},{128,256,256,256,256,128,},{128,256,256,256,256,128,},{128,256,256,256,256,128,},{128,256,256,256,256,128,},{128,256,256,256,256,128,},{128,256,256,256,256,128,},{128,256,256,256,256,128,},{128,128,256,256,128,128,},{0,16384,16384,16384,16384,0,},{16384,2,2,2,2,16384,},{16384,2,2,16,16,16384,},{16384,16,16,16,2,16384,},{0,16384,16384,16384,16384,0,},}
sprite.uw = {{0,16384,16384,16384,16384,0,},{16384,16,16,2,2,16384,},{16384,16,2,2,2,16384,},{16384,2,2,16,16,16384,},{0,16384,16384,16384,16384,0,},{128,128,256,256,128,128,},{128,256,256,256,256,128,},{128,256,256,256,256,128,},{128,256,256,256,256,128,},{128,256,256,256,256,128,},{128,256,256,256,256,128,},{128,256,256,256,256,128,},{128,256,256,256,256,128,},{128,256,256,256,256,128,},{128,256,256,256,256,128,},{128,256,256,256,256,128,},{128,256,256,256,256,128,},{128,256,256,256,256,128,},{128,256,256,256,256,128,},{128,128,128,128,128,128,},}
sprite.guy = {{2,0,8192,32,32,0},{16384,8192,8192,32,2048,32},{2,0,8192,32,32,0}}
sprite.guybig = {{},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,32,32,32,32,32,32,32,},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,32,32,32,32,32,32,32,32,32,32,32,32,32,},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,32,32,32,32,32,32,32,32,32768,32768,32,32,32,32,32,32,32,},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,32,32,32,32,32,32,32,32,32,32,32768,8,8,32768,32,32,32,32,32,32,},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,32,32,32,32,32,32,32,32,32,32,0,8,8,8,8,32768,32,32,32,32,0,},{0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,32,32,32,32,32,32,32,32,32,32,32,32,32768,8,8,8,32768,32,32,32,32,32,0,},{0,0,0,0,0,0,0,0,0,0,0,0,0,8192,8192,8192,32,32,32,32,32,32,32,32,32,32,32,32,32768,32768,32768,32,32,32,32,32,0,0,},{0,0,0,0,0,0,0,0,0,0,0,0,0,8192,8192,8192,8192,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,0,0,},{0,0,0,0,0,0,0,0,0,0,0,0,0,8192,8192,8192,8192,8192,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,0,0,0,},{0,0,0,0,0,0,0,0,0,0,0,0,8192,8192,8192,8192,8192,8192,8192,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,0,0,0,0,},{0,0,0,0,0,0,0,0,0,0,0,0,8192,8192,8192,8192,8192,8192,8192,8192,8192,32,32,32,32,32,32,32,32,32,32,32,32,0,0,0,0,0,},{0,0,0,0,0,0,0,0,0,0,0,0,0,8192,8192,8192,8192,8192,8192,8192,8192,8192,8192,8192,8192,32,32,32,32,32,32,32,0,0,0,0,0,0,},{0,0,0,0,0,0,0,0,0,0,0,0,256,256,8192,8192,8192,8192,8192,8192,8192,8192,8192,8192,8192,8192,8192,8192,8192,8192,0,0,0,0,0,0,0,0,},{0,0,0,0,0,0,0,0,0,0,0,256,256,256,256,256,8192,8192,8192,8192,8192,8192,8192,8192,8192,8192,8192,8192,8192,0,0,0,0,0,0,0,0,0,},{0,0,0,0,0,0,0,0,0,0,0,2,2048,256,256,256,256,8192,8192,8192,8192,8192,8192,8192,8192,8192,8192,0,0,0,0,0,0,0,0,0,0,0,},{0,0,0,0,0,0,2,2,2,2,2,2,2048,2048,2048,256,256,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},{0,0,0,0,2,2,2,2,2,2,16,16,16,16,16,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},{0,0,0,2,2,2,2,2,2,16,16,16,16,16,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},{0,0,0,0,0,0,2,2,2,2,16,16,16,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},{0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},{0,0,0,0,0,2,0,0,0,2,2,2,2,2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},{0,0,0,0,0,0,0,0,0,2,0,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,}}
sprite.title = {{1,1,1,1,1,0,1,0,0,0,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,0,0,0,0,0,0,0,},{1,1,1,1,1,0,1,0,0,0,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,0,0,0,0,0,0,0,},{1,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,},{1,1,1,1,1,0,1,0,0,0,1,0,1,1,1,1,1,0,1,1,1,1,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,},{0,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,},{0,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,},{1,1,1,1,1,0,1,1,1,1,1,0,1,0,0,0,0,0,1,1,1,1,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,},{1,1,1,1,1,0,1,1,1,1,1,0,1,0,0,0,0,0,1,1,1,1,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,},{},{8,8,8,8,8,0,0,0,0,8,8,8,8,8,0,0,8,8,8,8,8,0,0,0,0,8,8,8,8,0,0,8,8,8,8,8,8,},{8,8,8,8,8,8,0,0,8,8,8,8,8,8,8,0,8,8,8,8,8,8,0,0,8,8,8,8,8,8,0,8,8,8,8,8,8,},{8,8,0,0,8,8,8,0,8,8,0,0,0,8,8,0,8,8,0,0,8,8,8,0,8,8,0,0,8,8,0,8,8,0,0,0,0,},{8,8,0,0,0,8,8,0,8,8,0,0,0,8,8,0,8,8,0,0,0,8,8,0,8,8,0,0,0,0,0,8,8,8,8,8,0,},{8,8,0,0,0,8,8,0,8,8,0,0,0,8,8,0,8,8,0,0,0,8,8,0,8,8,0,8,8,8,0,8,8,0,0,0,0,},{8,8,0,0,8,8,8,0,8,8,0,0,0,8,8,0,8,8,0,0,8,8,8,0,8,8,0,0,8,8,0,8,8,0,0,0,0,},{8,8,8,8,8,8,0,0,8,8,8,8,8,8,8,0,8,8,8,8,8,8,0,0,8,8,8,8,8,8,0,8,8,8,8,8,8,},{8,8,8,8,8,0,0,0,0,8,8,8,8,8,0,0,8,8,8,8,8,0,0,0,0,8,8,8,8,0,0,8,8,8,8,8,8,}}
sprite.bg = {{32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768},{32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768},{4096,32768,32768,32768,32768,32768,32768,32768,32768,4096,4096,4096,4096,4096,4096,4096,4096,4096},{4096,4096,4096,4096,4096,4096,4096,4096,4096,4096,0,0,0,0,0,0,0,0},{},{},{},{},{},{},{},{},{},{},{},{4096,4096,4096,4096,4096,4096,4096,4096,4096,4096,0,0,0,0,0,0,0,0},{4096,32768,32768,32768,32768,32768,32768,32768,32768,4096,4096,4096,4096,4096,4096,4096,4096,4096},{32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768},{32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768,32768}}
local gm = {
x = 2,
y = math.floor(scr_y/2),
score = 0,
hiscore = 0,
deaths = 0,
}
local walls = {}
local keysDown = {}
local inc = function(a)
local x,y = term.getCursorPos()
term.setCursorPos(x,y+a)
end
local addWall = function()
table.insert(walls,{x=scr_x,y=math.random(4,scr_y-4)})
end
local moveWalls
moveWalls = function()
for k,v in pairs(walls) do
if walls[k] then
walls[k].x = walls[k].x - 1
if walls[k].x <= -5 then
walls[k] = nil
moveWalls()
break
end
end
end
end
local renderBG = function(scroll,bgscroll)
local ivl = 5 --interval
local skew = 2
term.setBackgroundColor(colors.black)
term.clear()
local pos = (ivl - scroll) + 1
while pos <= scr_x do
local endpos = ((pos-(scr_x/2))*(skew))+(scr_x/2)
local midpos = ((pos-(scr_x/2))*(skew*0.8))+(scr_x/2) -- skew*0.75 is perfect lines
paintutils.drawLine(endpos, scr_y, midpos, scr_y*0.75, colors.cyan) --render bottom
paintutils.drawLine(midpos, scr_y*0.75, pos , scr_y*0.5, colors.lightBlue) --render bottom
paintutils.drawLine(endpos, 1, midpos, scr_y*0.25, colors.cyan) --render top
paintutils.drawLine(midpos, scr_y*0.25, pos, scr_y*0.5, colors.lightBlue) --render top
pos = pos + ivl
end
for x = 1-bgscroll, scr_x, 18 do
paintutils.drawImage(sprite.bg,x,1)
end
end
local gap = 6
local t = term.current().setVisible
local checkCollision = function()
for k,v in pairs(walls) do
if gm.x >= v.x-3 and gm.x <= v.x+3 then --intentionally allowed front and back to touch wall
if math.abs((gm.y+1) - v.y) >= (gap/2)-1 then
return false
end
end
end
return true
end
local render = function(scroll,bgscroll)
if t then t(false) end
renderBG(scroll,bgscroll)
paintutils.drawImage(sprite.guy,gm.x,gm.y)
for k,v in pairs(walls) do
paintutils.drawImage(sprite.uw,v.x,v.y+(gap/2))
paintutils.drawImage(sprite.dw,v.x,(v.y-(gap/2))-scr_y)
end
term.setCursorPos(2,1)
term.setBackgroundColor(colors.black)
term.clearLine()
write("SCORE: "..gm.score.." ")
if t then t(true) end
end
local game = function()
local scroll = 1
local frame = 0
local maxframe = 32
local bgscroll = 0
while true do
render(math.floor(scroll),math.floor(bgscroll))
scroll = scroll + 0.5
frame = frame + 1
bgscroll = bgscroll + 2
if scroll % 5 == 0 then
scroll = 0
end
if frame == maxframe then
addWall()
frame = 1
end
if bgscroll % 18 == 0 then
bgscroll = 0
end
moveWalls()
if keysDown[keys.up] and gm.y > 2 then
gm.y = gm.y - 1
end
if keysDown[keys.down] and gm.y < scr_y-3 then
gm.y = gm.y + 1
end
local isHit = not checkCollision()
if isHit then
return
end
gm.score = gm.score + 1
if gm.hiscore < gm.score then --conglaturations
gm.hiscore = gm.score
end
sleep(0)
end
end
local getInput = function()
while true do
local evt, key = os.pullEvent()
if evt == "key" then
keysDown[key] = true
elseif evt == "key_up" then
keysDown[key] = false
end
if key == keys.q then
return
end
end
end
local cleanExit = function()
term.setBackgroundColor(colors.black)
term.setTextColor(colors.white)
term.clear()
term.setCursorPos(1,1)
print("Thanks for playing!")
if t then t(true) end
sleep(0.05)
end
local showTitle = function()
if gm.deaths == 0 then
local x = -38
local y = scr_y
repeat
y = y - 1
x = x + 2
if t then t(false) end
term.setBackgroundColor(colors.black)
term.clear()
paintutils.drawImage(sprite.guybig,math.floor(x),math.floor(y))
if t then t(true) end
sleep(0)
until y <= -24
end
term.setBackgroundColor(colors.white)
term.clear()
sleep(0)
term.setBackgroundColor(colors.black)
term.clear()
paintutils.drawImage(sprite.title,3,2)
sleep(0.1)
term.setCursorPos(4,scr_y)
term.setTextColor(colors.white)
term.setBackgroundColor(colors.black)
term.write("PUSH ANY KEY TO NEXT")
term.setCursorPos(2,1)
write("TOP: "..gm.hiscore.." | LAST: "..gm.score)
os.pullEvent("char")
end
while true do
showTitle()
walls = {}
gm.y = math.floor(scr_y/2)
gm.score = 0
keysDown = {}
local res = parallel.waitForAny(getInput,game)
if res == 2 then
gm.deaths = gm.deaths + 1
else
cleanExit()
break
end
end

1042
sinelock.lua Normal file

File diff suppressed because it is too large Load Diff

111
trippy-scr.lua Normal file
View File

@ -0,0 +1,111 @@
local tArg = {...}
local scr_x, scr_y = term.getSize()
local mx, my = scr_x/2, scr_y/2
-- special modes for special people
local mouseMode = tArg[1] == "mouse" or tArg[2] == "mouse"
local fuck = tArg[1] == "fuck" or tArg[2] == "fuck"
-- localize functions to increase speed, maybe, I think
local concat, blit = table.concat, term.blit
local sin, cos, rad, abs, sqrt, floor = math.sin, math.cos, math.rad, math.abs, math.sqrt, math.floor
-- rainbow pattern
local palette = {"e","1","4","5","d","9","b","a","2"}
local distance = function(x1, y1, x2, y2)
return sqrt( (x2 - x1) ^ 2 + (y2 - y1) ^ 2 )
end
local randCase = function(str)
local output = ""
for i = 1, #str do
output = output .. ((math.random(0,1) == 1) and str:sub(i,i):upper() or str:sub(i,i):lower())
end
return output
end
local render = function(iterate, xscroll1, yscroll1, xscroll2, yscroll2)
local buffer, cx, cy = {{},{},{}}
for y = 1, scr_y do
buffer[1][y] = {}
buffer[2][y] = {}
buffer[3][y] = {}
for x = 1, scr_x do
cx = 0.66 * ((x - mx) > 0 and 1 or -1) * (abs(x - mx) ^ 1.2)
cy = ((y - my) > 0 and 1 or -1) * (abs(y - my) ^ 1.2)
buffer[1][y][x] = fuck and randCase("fuck"):sub(1+(cx%4),1+(cx%4)) or "\127"
buffer[2][y][x] = palette[1 + floor(
iterate + distance( cx + xscroll1, cy + yscroll1, 0, 0 )
) % #palette] or " "
buffer[3][y][x] = palette[1 + floor(
iterate + distance( cx + xscroll2, cy + yscroll2, 0, 0 )
) % #palette] or " "
end
end
for y = 1, scr_y do
term.setCursorPos(1,y)
-- suka
blit(
concat(buffer[1][y]),
concat(buffer[2][y]),
concat(buffer[3][y])
)
end
end
local main = function()
term.clear()
local wave, evt = 0
local xscroll1, yscroll1, xscroll2, yscroll2 = 0, 0, 0, 0
if mouseMode then
parallel.waitForAny(function()
while true do
evt = {os.pullEvent()}
if evt[1] == "mouse_click" or evt[1] == "mouse_drag" then
if evt[2] == 1 then
xscroll1 = mx - evt[3]
yscroll1 = my - evt[4]
elseif evt[2] == 2 then
xscroll2 = mx - evt[3]
yscroll2 = my - evt[4]
end
end
end
end,
function()
while true do
render(wave, xscroll1, yscroll1, xscroll2, yscroll2)
wave = (wave + 1) % (360 * 7)
sleep(0.05)
end
end)
else
while true do
xscroll1 = -sin(rad(wave * 2)) * scr_x * 0.4
yscroll1 = -cos(rad(wave * 3.5)) * scr_y * 0.4
xscroll2 = -xscroll1
yscroll2 = -yscroll1
render(wave, xscroll1, yscroll1, xscroll2, yscroll2)
wave = (wave + 1) % (360 * 7)
sleep(0.05)
end
end
end
-- wait for keypress to exit program
local waitForInput = function()
local evt
sleep(0.25)
os.pullEvent("key")
end
parallel.waitForAny(main, waitForInput)
term.clear()
term.setCursorPos(1,1)
sleep(0.05)

75
wpath.lua Normal file
View File

@ -0,0 +1,75 @@
-- Wavey Path
-- Makes a wavey path to the right
local wpath = {}
wpath.cols = "e145d9ba26"
wpath.bwcols = "087f78"
wpath.waveLen = 3
wpath.textScale = 2.5
wpath.delay = 0.05
local rbow,bbow
local sizePath = "size.lua"
if not peripheral.find("monitor") then
return
end
local reset = function()
rbow,bbow = "",""
for a = 1,#wpath.cols do
rbow = rbow..wpath.cols:sub(a,a):rep(wpath.waveLen)
end
for a = 1,#wpath.bwcols do
bbow = bbow..wpath.bwcols:sub(a,a):rep(wpath.waveLen)
end
end
reset()
local mons = {peripheral.find("monitor")}
local setscales = function()
for a = 1, #mons do
mons[a].setTextScale(wpath.textScale)
end
end
local wrap = function(txt,amnt)
local output = {}
for a = 0, #txt-1 do
output[((a+amnt) % #txt)+1] = txt:sub(a+1,a+1)
end
return table.concat(output)
end
local render = function(shift,mon)
local line
if not mon.getSize then return end
local scr_x,scr_y = mon.getSize()
scr_y = scr_y + (scr_y % 2)
bow = mon.isColor() and rbow or bbow
for y = 1, scr_y do
mon.setCursorPos(1,y)
line = bow:rep(scr_x):sub(1,scr_x)
local text = ("#"):rep(scr_x)
local txcol = wrap(line, -1*math.abs(y-scr_y/2)+shift-1)
local bgcol = wrap(line, -1*math.abs(y-scr_y/2)+shift)
mon.blit(text,txcol,bgcol)
end
end
local DOITNOW = function(YOUFUCKINGTWAT)
local shift = 0
while true do
shift = (shift + 1)
mons = {peripheral.find("monitor")}
setscales()
for a = 1, #mons do
render(shift,mons[a])
end
sleep(wpath.delay)
end
end
--parallel.waitForAny(checkForReset,DOITNOW)
DOITNOW()