Skip to main content

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

I love it, all the different patterns, looks so nice. Great job.

There's some suggestions to shrink your code.

Semicolons (;) are'nt needed

if(v==2)x+=1;m() -> if(v==2)x+=1m()

If it did'nt work, use ; or space otherway.

Your r() function take more characters than use r(8)\1 each time.

function + call it 4 times = 40 chars
function l()return r(8)\1endr()r()r()r()
6 chars * 4 times = 24 chars
r(8)\1r(8)\1r(8)\1r(8)\1

Maybe you can change _init and _draw with labels ::i:: and ::d::, you can change both or only _draw. You can't call a label that's outside of the function.

This can be write in another way (11 chars to 8 chars).

(r(3)-1)\1) -> r(3)\1-1

With this, try to correct the monsters spawn when a new level is created.

(1 edit)

Thanks, this helps a lot. I’ve implemented all of these except the GOTOs. Can you explain more about how that works?

I added in checks to make sure monsters don’t start on top of player when new level drawn.

Current code, 507 chars:

r,x,y,f=rnd,3,3,1function _init()
e={}a=r(8)\1b=r(8)\1
for i=1,5do repeat e[i]={x=r(8)\1,y=r(8)\1}until e[i].x!=x and e[i].y!=y end m()end
function _draw()v=btnp()
if(v==2)x+=1m()
if(v==1)x-=1m()
if(v==4)y-=1m()
if(v==8)y+=1m()end function m()c=114d=16for y=0,c,d do for x=0,c,d do
fillp(r(9999))rectfill(x,y,x+d,y+d,2)end end
?"▒",a*d+4,b*d+5,9
?"🐱",x*d+4,y*d+5
?f,2,2
for j in all(e)do
j.x+=r(3)\1-1
j.y+=r(3)\1-1
?"😐",j.x*d+4,j.y*d+5,8
if(j.x==x and j.y==y)f=1stop()
if(x==a and y==b)f+=1_init()
end end

Okay, I’ve shaved off a bit more. In the end, I moved the score in the location of the ‘cat’s tail’ (let me shave off the last 2 chars.

r,x,y,f=rnd,3,3,1function _init()
e={}a=r(8)\1b=r(8)\1
for i=1,5do repeat e[i]={x=r(8)\1,y=r(8)\1}until e[i].x!=x or e[i].y!=y end m()end
function _draw()v=btnp()
if(v==2)x+=1m()
if(v==1)x-=1m()
if(v==4)y-=1m()
if(v==8)y+=1m()end function m()d=16for y=0,114,d do for x=0,114,d do
fillp(r(9999))rectfill(x,y,x+d,y+d,2)end end
?"▒",a*d+4,b*d+5,9
?"🐱"..f,x*d+4,y*d+5
for j in all(e)do
j.x+=r(3)\1-1
j.y+=r(3)\1-1
?"😐",j.x*d+4,j.y*d+5,8
if(j.x==x and j.y==y)stop()
if(x==a and y==b)f+=1_init()
end end

I made a third fix and restored the score to the top left corner.