Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit) (+1)

Thanks! Like I wrote it would be possible to reduce the size of the code and make the card more readable. I made a simpler version at first with a bigger font size and even a qr code that linked to the page on itch.io. But I think the final version is a lot more fun.

Just in case you want to test it, this is the smaller earlier version:

<html><boby><textarea id="a" rows="24" cols="64" readonly>
</textarea><br><input id="i" type="number" ></body><script
type="text/x">$i=%E('i');$a=%E('a'); i.focus();$P=(t)=>{a.
value+=t+'\n'}; $C=()=>{a.value=''}; $S=(a)=>{ a.sort(()=>
Math.random()-0.5);->a};$L=(a)=>a.length;$T=(a)=>a[L(a)-1]
i.addEventListener('keyup',(e)=>{if(e.keyCode===13){e['p'+
'reventDefault']();SO(i.value-1);i.value='';UP()}});$io={}
$o=[];$RO=()=>{o=[]}; $or=[]; $on=['north','east','south',
'west'];$CR=(p,dn=0,e=0)=>{$r={d:S([0,1,2,3]),o:[],AO(op){
op.t=4;op.on=1;if(!r.o)r.o=[];if(op.id){io[op.id]=op}r.o<-
(op);->r},BK(){cr=p},dn:dn};if(p){$d=p.d.pop();r.d.splice(
r.d.indexOf((d+2)%4),1);p.o<-({t:d,on:1,f(){cr=r},});r.o<-
({t:(d+2)%4,on:1,f(){cr=p}});if(!L(p.d))or=or.filter((v,i,
a)=>v!=p)}if(!e)or<-(r); S(or);->r};$GR=()=>T(S(or));$HO=(
)=>{$l=[];$oi=1;if(cr){cr.o.sort((a,b)=>a.t-b.t);$s='';$d=
''; cr.o.forEach((o,i)=>{if((o.on==1)&&(!(cr.dn)||o.t>3)){
l<-(o);if('DE' in o)d=o.DE(); s+='\n  ['+oi+'] : '+(o.t<4?
'go '+on[o.t]:o.TS());oi++}});d=d?d:'The room is empty.';P
(d);P('\noptions:');P(s)}->l}; $SO=(i)=>{C();if(i<0||i>=L(
ol))->;ol[i].f()};$DM=(d)=>{lp-=d-_s;if(lp<=0){lp=0;cr=re}
};$re;$N=()=>{io={};mx=5;lp=mx;it=[]; _d=0;_k=0;_s=0;_w=0;
_g1=0;_o=0;re=CR(null,0,1~ON();~N'GAME OVER'~S'new game'}}
);$r1=CR(null,0,1);$r2=CR(null);(r1~Ocr=r2;~N'#Y dungeon'+
' entrance.'~S'enter'}});CR(r2~O_d=1;@on=0;it<-('dagger');
~N'#Y dagger.'~S'#tdagger'}});$r4=CR(r2,1~Oif(_k){_k--;@l=
0;cr.dn=0;@on=0}else{cr.BK()}~N'#Tlocked door.'~S_k?'ope'+
'n door':'go back'},dn:1,l:1}); CR(r2,1~O@eh-=_w?2:_d;if(@
eh)DM(1);if(!@eh){_g1=1;cr.dn=0;@on=0;io[1].on=0;io[2].on=
1; }~N'#Tgoblin (\u2665 '+@eh+'/3).'~S'attack'},eh:3}~Ocr.
BK();~S'flee'},id:1}~O_k++;@on=0;~N'The goblin#dkey.'~S''+
'#tkey'},id:2});io[2].on=0; CR(r4~Omx+=2;lp=mx;@on=0;~N''+
'#Y #P.'~S'drink#P'}});$r7=CR(T(or));CR(r7,1~O@eh-=_w?2:_d
if(@eh)DM(2);if(!@eh){_g1=1; cr.dn=0;@on=0;io[3].on=0;io[4
].on=1}~N'There is an orc (\u2665 '+@eh+'/4).'~S'attack'},
eh:4}~Ocr.BK(); ~S'flee'},id:3}~O_d=1;@on=0;it<-('sword');
~N'The orc#dsword.'~S'#tsword'},id:4});io[4].on=0;for($t=0
;t<2;t++){CR(T(or)~Omx+=2;lp=mx;@on=0;~N'#Y#P.'~S'drink#P'
}})} CR(T(or)~O_s=1; @on=0; it<-('shield'); ~N'#Y shield.'
~S'#tshield'}});CR(T(or),1~O@eh-=_w?2:_d;if(@eh)DM(3);if(!
@eh){_g1=1;cr.dn=1;@on=0;io[5].on=0;io[6].on=1}~N'#Tdrag'+
'on (\u2665 '+@eh+'/7).'~S'attack'},eh:7}~Ocr.BK();~S'fl'+
'ee'},id:5}~ON();~N'Congratulations! You killed the drag'+
'on!'~S'new game'},id:6});io[6].on=0;cr=r1}; N();$ol;$UP=(
)=>{P('\u2665 '+lp+'/'+mx);P('keys: '+_k); P('items: '+(L(
it)?it.join(', ') : '-')); P(''); ol=HO()}; UP();</script>
<script>var A=(t,s,r)=>{return t.split(s).join(r)},K={'%E'
:'document.getElementById','$':'var ','->':'return ','%?':
'.includes', '@':'this.','\r':'','#P' : ' healing potion',
'#Y':'You see a','#T':'There is a ','#t':'take ','~O':')'+
'.AO({f(){','~S':'},TS(){return ','~N' : '},DE(){return ',
'#d':' dropped a ','<-':'.push'},R=(x)=>{for(var k in K)x=
A(x,k,K[k]);eval(x)},C=document.querySelectorAll('script'+
'[type="text/x"]'); for( var i=0; i<C.length; i++ )R(C[i].
innerHTML);/* * *     HAVE FUN!     * * */</script></html>

(EDIT: The code didn’t fit in properly – so I did some formatting …)

Cool! But I think this version may be a bit bugged? Not sure if I'm just bad at directions, but after picking up the dagger + shield, I ended up somehow not being able to progress. I got stuck in almost like a triangle pattern of rooms. Nothing in any rooms, and couldn't go back to see other enemies... Like I said, maybe I'm just bad at directions lol, but I think something bugs out & traps me into a dead end.

(+1)

Could be some kind of bug since I remember removing one in the later version but I don’t know if it already existed in this early version. But it could also be that the structure of the dungeon is not that intuitive. The dungeon is different every time and the layout of the rooms is basically a tree structure, so there should be no circles … it’s more like the corridors connecting the rooms can be different in length. Going NORTH→EAST→SOUTH→WEST does not mean that you went in a circle.

 Not like this:       |  More like this:
                      |
 #######     #######  |  #######     #######
 #     #     #     #  |  #     #     #     #
 #  2> .......  3  #  |  #  2> .......  3  #
 #     #     #  v  #  |  #     #     #  v  #
 ###:###     ###:###  |  ###:###     ###:###
    :           :     |     :           : 
    :           :     |  ###:###        : 
    :           :     |  #  ^  #        : 
    :           :     |  #  1  #        : 
 ###:###     ###:###  |  #     #        : 
 #  ^  #     #     #  |  #######        : 
 #  1 5....... <4  #  |                 : 
 #     #     #     #  |  #######     ###:###
 #######     #######  |  #     #     #     #
                      |  #  5  ....... <4  #
                      |  #     #     #     #
                      |  #######     #######
If you have have problems finding your way through the dungeon you can try to always stay at the right or at the left wall. This also works in most normal labyrinths (but not in labyrinths with circles).