Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

There's definetly some more characters to be squeezed out here by just removing some of the whitespace and linebreaks. I managed to cut 18 characters off your code and not removing any logic, so there may be space for line clearing yet!

I was making my own version of tetris but it looks like I won't have space for the full game, here's what I have for line clearing though, it should work quite nicely for your version too;


::c::
for y=63,4,-1 do
l=true
for x=0,63 do
l=l and pget(x,y)>0
end
if(l)memcpy(24576+64,24576,y*64)goto c
end
end

Basically, start from the bottom of the screen and work up, check each pixel from left to right, if not black, keep l to be true. If l is true after checking the whole line, copy the screen data from the top down to the line we just checked down by 1 line and start the check again (we might have multiple completed lines and continuing in the current loop might miss them!).

Anyway, excellent game, love the idea!

Hope to see you for TTJ5!

Yeah, once I got under the character limit, I stopped trying to optimize. That line-clearing code is much much cleaner than what I had:

for j=17,58 do
for i=5,58 do
if(q(i,j)==0)break
if i==58 then
s+=50
rect(5,j,58,j,0)
for u=j,18,-1 do
for w=5,58 do
z(w,u,q(w,u-1))
z(w,u-1,0)
end
end
end
end
end