The prisoner of Sokoban
About
The goal of this game is to escape to one of the edges of the level using block-pushing mechanics. The level is a 100*100 grid and you start at the center. This was made for tweet tweet jam 3, the goal was to code with as few characters as possible. There is also a sequel which you can play here.
Controls:
Mouse only. Click around your character (the @) to move it. Move towards a block that has space behind it to push it.
The code: use any version of game maker or game maker studio and copypaste the following code in the draw event of an object that you place at the 0,0 position of a 256*144 room:
draw_set_halign(1)
if x==0 {e=128 f=72 w=0 x=-1 y=x repeat 99 {x+=1 y=-1 repeat 99 {y+=1 t[x,y]=choose(0,1)}} x=49 y=x t[x,y]=0}
a=0 b=0 c=mouse_x-e d=mouse_y-f if mouse_check_button_pressed(mb_left) {h=abs(c) i=abs(d) a=(h>i?sign(c):0) b=(i>h?sign(d):0)}
if x<2 or y<2 or x>96 or y>96 w=1 else {
if t[x+a,y]==0 x+=a else {if t[x+a*2,y]==0 {t[x+a,y]=0 t[x+a*2,y]=1}}
if t[x,y+b]==0 y+=b else {if t[x,y+b*2]==0 {t[x,y+b]=0 t[x,y+b*2]=1}}
u=0 v=0 repeat 97 {u+=1 v=0 repeat 97 {v+=1 draw_text(e+(u-x)*16,f+(v-y)*16,t[u,v]==1?"X":" ")}}}
draw_text(e,f,w?"Win":"@")