Skip to content

Instantly share code, notes, and snippets.

@SergioFLS
Created April 20, 2018 01:38
Show Gist options
  • Select an option

  • Save SergioFLS/bdfb805f7b1bc50901a5ce19c258110d to your computer and use it in GitHub Desktop.

Select an option

Save SergioFLS/bdfb805f7b1bc50901a5ce19c258110d to your computer and use it in GitHub Desktop.
something i was making in TIC-80
-- title: game title
-- author: SergioFLS
-- desc: messing around with TIC-80
-- script: lua
function debug(enabled)
if enabled then
print("X: " .. x .. "\nY: " .. y .. "\nTitle ID: " .. mget(x+14,y+8) .. "\nDown Pressed: ",0,0)
end
end
function Init()
x=0 --112
y=0 --64
end
function Update()
if btnp(0,30,3) then
if mget(x+14,y+7) == 2 then
sfx(1)
else
y=y-1
sfx(0)
end
elseif btnp(1,30,3) then
if mget(x+14,y+-1) == 2 then
sfx(1)
else
y=y+1
sfx(0)
end
elseif btnp(2,30,3) then
if mget(x+13,y+8) == 2 then
sfx(1)
else
x=x-1
sfx(0)
end
elseif btnp(3,30,3) then
if mget(x+15,y+8) == 2 then
sfx(1)
else
x=x+1
sfx(0)
end
end
--[[ if btnp(0,30,3) then y=y-1 sfx(0) bg=bg+1 end
if btnp(1,30,3) then y=y+1 sfx(0) bg=bg+1 end
if btnp(2,30,3) then x=x-1 sfx(0) bg=bg+1 end
if btnp(3,30,3) then x=x+1 sfx(0) bg=bg+1 end]]
end
function Draw()
map(x,y,100,100,0,0) --112,64
spr(256,112,64,-1,1,0,0,1,1)
print("HELLO WORLD!",84,84)
debug(true)
end
Init()
function TIC()
Update()
Draw()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment