tweet sand
About
A small falling sand game in less then 560 characters of code.
Controls:
- Scroll left and right with arrow keys
- Z to place sand
This game was made for #TweetTweetJam 4. The rules of this jam are that the code must be able to fit within two tweets with no other assets other then the code.
Code:
i,g,h,w,a=0,30,60,btn,{}
for x=0,128 do
a[x] = {}
for y=0,128 do
a[x][y] = 0
end
end
function b()
cls(0)
for x=128,0,-1 do
for y=128,0,-1 do
if(a[x][y] == 1)then
if a[x][y+1] == 0 then
a[x][y] = 0 a[x][y+1] = 1
elseif a[x+1&127][y+1] == 0 then
a[x][y] = 0
a[x+1&127][y+1] = 1
elseif a[x-1&127][y+1] == 0 then
a[x][y] = 0
a[x-1&127][y+1] = 1
end
pset(x,y,10)
end end end end
function _update()
if(w(0))then g-=1&127 end
if(w(1))then g+=1&127 end
if(w(4))then a[g][h] = 1 end
if i==1 then b() i=0 end
i+=1
end
System requirements for Web
Last Modified: May 8, 2020
Where to buy
itch.io