Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
A jam submission

1k RoguelikeView game page

A roguelike written in 1kb for the 1kPico Jam!
Submitted by NorthStateGames — 26 days, 2 hours before the deadline

Play game

1k Roguelike's itch.io page

Compressed Bytes used
1024

Source Code (OPTIONAL)
function _init()
lvl=1vis=40
nl()
end

function nl()
sl={112,104,88,80}
sx=rnd(sl)
sy=rnd(sl)
x=24y=24es=2msg=0hp=3sv=0
el={}
wl={}
adde()
wt={72,56,32,96}
while #wt>3do
dx=rnd(wt)
dy=rnd(wt)
wa=8
wy=8
while wa<128 and wy<128 do
if wa==8 or wa==120 or wy==8 or wy==120 then
addw(wa,wy)
end
if (wy==dy and wa~=64 and wa!=16 and wa!=112)or(wa==dx and wy~=64) then
addw(wa,wy)
end
wa+=8
if wa>=128 then
wa=8
wy+=8
end
end
del(wt,dx)
end
end

function addw(aa,ss)
local w={
x=aa,
y=ss,
v=0
}
add(wl,w)
end

function adde()
local ec={64,48,80,40}
for i=1,es do
es-=1
local e={
x=rnd(ec),
y=rnd(ec),
hp=flr(rnd(3))+1
}
del(ec,e.x)
del(ec,e.y)
add(el,e)
end
end

function _update()
if (btnp(0))x-=8mv()
if (btnp(1))x+=8mv()
if (btnp(2))y-=8mv()
if (btnp(3))y+=8mv()
for p=1,#wl do
if (x==wl[p].x and y==wl[p].y) then
if btnp(0)then
x+=8
elseif btnp(1)then
x-=8
elseif btnp(2)then
y+=8
elseif btnp(3)then
y-=8
end
end
end
for q=1,#el do
if btnp(0)and (x==el[q].x and y==el[q].y)then
el[q].hp-=1
if el[q].hp>0 then
x+=8
hp-=1
end
elseif btnp(1) and (x==el[q].x and y==el[q].y)then
el[q].hp-=1
if el[q].hp>0 then
x-=8
hp-=1
end
elseif btnp(2) and (x==el[q].x and y==el[q].y)then
el[q].hp-=1
if el[q].hp>0 then
y+=8
hp-=1
end
elseif btnp(3) and (x==el[q].x and y==el[q].y)then
el[q].hp-=1
if el[q].hp>0 then
y-=8
hp-=1
end
end
end
if hp<=0 then
_init()
end
for e in all(el) do
if e.hp<=0 then
del(el,e)
end
end
if x==sx and y==sy then
if #el<=0 then
nl()
lvl+=1
if lvl==6 then
msg=2
end
else
msg=1
end
end
cls(1)
?"@",x,y,7
if dist(sx,x,sy,y)<=vis or sv==1 then
?"s",sx,sy,13
sv=1
end
for e in all(el) do
if dist(e.x,x,e.y,y)<=vis then
?"o",e.x,e.y,3
local mhp=e.hp*2
while mhp>0 do
pset(e.x+mhp-3,e.y-2,8)
mhp-=2
end
end
end
for w in all(wl) do
if dist(w.x,x,w.y,y)<=vis or w.v==1 then
?"#",w.x,w.y,5
w.v=1
end
end
?"hp"..hp.." lvl"..lvl,50,1,7
if msg==1 then
?"defeat enemies",50,50,7
elseif msg==2 then
?"win",50,50,7
end
end

function dist(x1,x,y1,y)
return abs(x1-x)+abs(y1-y)
end

function mv()
for e in all(el) do
local bx,by=0,0
if x<e.x then
bx-=8
elseif x>e.x then
bx+=8
else
bx+=0
end
if y<e.y then
by-=8
elseif y>e.y then
by+=8
else
by+=0
end
for h=1,#wl do
if e.x+bx==wl[h].x and e.y+by==wl[h].y then
bx=0
by=0
end
end
if not(e.x+bx==x and e.y+by==y) then
e.y+=by
e.x+=bx
end
end
end

Leave a comment

Log in with itch.io to leave a comment.

Comments

Submitted(+1)

I love me a good roguelike. This is a nice throwback and it looks great for a 1K game!

I do feel like your chance of success is luck-based, mostly because your HP does not regenerate over time. This makes it difficult to rest up before taking on that last enemy and advance to the next level.

Then again, this is a 1K compo, and this is a lovely homage to a timeless game. Excellent!

Developer

Thanks for playing it!

I had lots of hopes to make it a little more well rounded but ran into that nasty 1k limit. Now that there's a compression optimizerthat was just released for this jam, I may take another pass at tweaking some things with this. I was really hoping to have enemies randomly drop healing potions to account for the HP difficulty.