You only use one hand. You only use the arrowkeys, never turning the camera, so it is impossible to get turned around.
Whether you use your left or right hand doensn't actually matter, that's not the point.
Here is a new challenge-
Balls of Fiery Doom
Try to reach the end of the maze now. It forces you to look where you are going, because those fires
burn.
If you click on a sphere it will be force up and away from you. But beware, they slide quite a bit, and it could backfire.
My record: 15x15
Uncompressed code-
sync on
sync rate 0
hide mouse
randomize timer()
disable escapekey
set text opaque
autocam off
set camera range 0.01,1000
color backdrop 0
while xtiles/2=xtiles/2.0 or xtiles<5
print "Value must be odd and atleast 5"
sync
input "X tiles ",xtiles
if escapekey()=1
end
endif
endwhile
while ytiles/2=ytiles/2.0 or ytiles<5
print "Value must be odd and atleast 5"
sync
input "Y tiles ",ytiles
if escapekey()=1
end
endif
endwhile
cls
counter=2*xtiles+2*ytiles-2
dim maze(xtiles,ytiles) as boolean
for x=1 to xtiles
maze(x,1)=1
maze(x,ytiles)=1
next x
for y=1 to ytiles
maze(1,y)=1
maze(xtiles,y)=1
next y
max=(xtiles*ytiles)-((xtiles-2)*(ytiles-2)-((xtiles-3)/2)*(ytiles-3))+2
xs#=screen width()/(xtiles+0.0)
ys#=screen height()/(ytiles+0.0)
while counter<max and escapekey()=0
x=rnd(xtiles-2)+1
y=rnd(ytiles-2)+1
if maze(x-1,y-1)=1 and maze(x-1,y)+maze(x,y-1)=0 or maze(x-1,y+1)=1 and maze(x-1,y)+maze(x,y+1)=0 or maze(x+1,y-1)=1 and maze(x+1,y)+maze(x,y-1)=0 or maze(x+1,y+1)=1 and maze(x+1,y)+maze(x,y+1)=0 or maze(x,y)=1 or x/2.0=x/2 and y/2.0=y/2 or maze(x-1,y)+maze(x+1,y)+maze(x,y-1)+maze(x,y+1)<>1
else
maze(x,y)=1
inc counter
endif
if spacekey()=1
text 0,0,left$(str$(counter/(max+0.0)*100),4)+"% done"
sync
endif
endwhile
cls
make memblock 1,12+(36*((max-1)*30-24))
write memblock dword 1,0,338
write memblock dword 1,4,36
write memblock dword 1,8,(max-1)*30-24
width=xtiles*10
height=ytiles*10
dh=10
for x=1 to xtiles
for y=1 to ytiles
if maze(x,y)=1
create_vertex(1,vertex,(x-1)*width/(xtiles+0.0),dh,(y-1)*height/(ytiles+0.0),rgb(255,255,255),0,0)
create_vertex(1,vertex+1,(x-1)*width/(xtiles+0.0),dh,y*height/(ytiles+0.0),rgb(255,255,255),0,1)
create_vertex(1,vertex+2,x*width/(xtiles+0.0),dh,(y-1)*height/(ytiles+0.0),rgb(255,255,255),1,0)
create_vertex(1,vertex+3,x*width/(xtiles+0.0),dh,(y-1)*height/(ytiles+0.0),rgb(255,255,255),1,0)
create_vertex(1,vertex+4,(x-1)*width/(xtiles+0.0),dh,y*height/(ytiles+0.0),rgb(255,255,255),0,1)
create_vertex(1,vertex+5,x*width/(xtiles+0.0),dh,y*height/(ytiles+0.0),rgb(255,255,255),1,1)
create_vertex(1,vertex+6,(x-1)*width/(xtiles+0.0),0,y*height/(ytiles+0.0),rgb(255,255,255),0,0)
create_vertex(1,vertex+7,x*width/(xtiles+0.0),dh,y*height/(ytiles+0.0),rgb(255,255,255),1,1)
create_vertex(1,vertex+8,(x-1)*width/(xtiles+0.0),dh,y*height/(ytiles+0.0),rgb(255,255,255),0,1)
create_vertex(1,vertex+9,x*width/(xtiles+0.0),0,y*height/(ytiles+0.0),rgb(255,255,255),1,0)
create_vertex(1,vertex+10,x*width/(xtiles+0.0),dh,y*height/(ytiles+0.0),rgb(255,255,255),1,1)
create_vertex(1,vertex+11,(x-1)*width/(xtiles+0.0),0,y*height/(ytiles+0.0),rgb(255,255,255),0,0)
create_vertex(1,vertex+12,(x-1)*width/(xtiles+0.0),0,(y-1)*height/(ytiles+0.0),rgb(255,255,255),0,0)
create_vertex(1,vertex+13,(x-1)*width/(xtiles+0.0),dh,(y-1)*height/(ytiles+0.0),rgb(255,255,255),0,1)
create_vertex(1,vertex+14,x*width/(xtiles+0.0),dh,(y-1)*height/(ytiles+0.0),rgb(255,255,255),1,1)
create_vertex(1,vertex+15,x*width/(xtiles+0.0),0,(y-1)*height/(ytiles+0.0),rgb(255,255,255),1,0)
create_vertex(1,vertex+16,(x-1)*width/(xtiles+0.0),0,(y-1)*height/(ytiles+0.0),rgb(255,255,255),0,0)
create_vertex(1,vertex+17,x*width/(xtiles+0.0),dh,(y-1)*height/(ytiles+0.0),rgb(255,255,255),1,1)
create_vertex(1,vertex+18,(x-1)*width/(xtiles+0.0),dh,(y-1)*height/(ytiles+0.0),rgb(255,255,255),1,0)
create_vertex(1,vertex+19,(x-1)*width/(xtiles+0.0),0,(y-1)*height/(ytiles+0.0),rgb(255,255,255),0,0)
create_vertex(1,vertex+20,(x-1)*width/(xtiles+0.0),0,y*height/(ytiles+0.0),rgb(255,255,255),0,1)
create_vertex(1,vertex+21,(x-1)*width/(xtiles+0.0),dh,y*height/(ytiles+0.0),rgb(255,255,255),1,1)
create_vertex(1,vertex+22,(x-1)*width/(xtiles+0.0),dh,(y-1)*height/(ytiles+0.0),rgb(255,255,255),1,0)
create_vertex(1,vertex+23,(x-1)*width/(xtiles+0.0),0,y*height/(ytiles+0.0),rgb(255,255,255),0,1)
create_vertex(1,vertex+24,x*width/(xtiles+0.0),dh,(y-1)*height/(ytiles+0.0),rgb(255,255,255),1,0)
create_vertex(1,vertex+25,x*width/(xtiles+0.0),0,y*height/(ytiles+0.0),rgb(255,255,255),0,1)
create_vertex(1,vertex+26,x*width/(xtiles+0.0),0,(y-1)*height/(ytiles+0.0),rgb(255,255,255),0,0)
create_vertex(1,vertex+27,x*width/(xtiles+0.0),dh,y*height/(ytiles+0.0),rgb(255,255,255),1,1)
create_vertex(1,vertex+28,x*width/(xtiles+0.0),0,y*height/(ytiles+0.0),rgb(255,255,255),0,1)
create_vertex(1,vertex+29,x*width/(xtiles+0.0),dh,(y-1)*height/(ytiles+0.0),rgb(255,255,255),1,0)
inc vertex,30
endif
next y
next x
create_vertex(1,vertex,0,0,0,rgb(255,255,255),0,0)
create_vertex(1,vertex+1,0,0,height,rgb(255,255,255),0,ytiles)
create_vertex(1,vertex+2,width,0,0,rgb(255,255,255),xtiles,0)
create_vertex(1,vertex+3,width,0,0,rgb(255,255,255),xtiles,0)
create_vertex(1,vertex+4,0,0,height,rgb(255,255,255),0,ytiles)
create_vertex(1,vertex+5,width,0,height,rgb(255,255,255),xtiles,ytiles)
make mesh from memblock 1,1
ode start : ode set world gravity 0,-20,0 : ode set world step 0.05
ode set world erp (0.2)*2.5 : ode set world cfm (10^-5)*2.5
convert mesh to vertexdata 1
make object 1,1,0
ode create static triangle mesh 1
delete memblock 1
delete mesh 1
set object cull 1,1
set object normals 1
width1=256
height1=256
make memblock 1,width1*height1*4+12
write memblock dword 1,0,width1
write memblock dword 1,4,height1
write memblock dword 1,8,32
for x=0 to width1-1
for y=0 to height1-1
write memblock dword 1,(y*width1+x)*4+12,rgb(0,rnd(255),0)
next y
next x
make image from memblock 1,1
width2=64
height2=64
make memblock 2,width2*height2*4+12
write memblock dword 2,0,width2
write memblock dword 2,4,height2
write memblock dword 2,8,32
for x=0 to width2-1
for y=0 to height2-1
write memblock dword 2,(y*width2+x)*4+12,rgb(0,0,0)
next y
next x
make image from memblock 2,2
texture object 1,1
make object sphere 2,10
position object 2,10*xtiles-15,dh/2,10*ytiles-15
color object 2,rgb(255,255,0)
position camera 15,5,15
speed#=0.2
make object cube 3,1
hide object 3
make object sphere 4,5
texture object 4,2
set object light 4,0
odeobjs=100
for obj=5 to odeobjs
instance object obj,4
position object obj,rnd(width),25,rnd(height)
ode create dynamic sphere obj
next obj
position object 4,rnd(width),25,rnd(height)
ode create dynamic sphere 4
health=100
while escapekey()=0
sync
text 0,0,"Health: "+str$(health)
px#=camera position x()
py#=camera position y()
pz#=camera position z()
x#=camera angle x()
xrotate camera 0
move camera speed#*(upkey()-downkey())
yrotate camera camera angle y()+90
move camera speed#*(rightkey()-leftkey())
rotate camera x#+mousemovey()/2.0,camera angle y()-90+mousemovex()/2.0,0
if camera angle x()>90
xrotate camera 90
endif
if camera angle x()<-90
xrotate camera -90
endif
if intersect object(1,px#,py#,pz#,camera position x(),camera position y(),camera position z())>0
position camera px#,py#,pz#
endif
position object 3,camera position x(),camera position y(),camera position z()
if object collision (2,3)=1
delete objects 1,odeobjs
t$="You beat a "+str$(xtiles)+" X "+str$(ytiles)+" maze!!!"
while escapekey()=0
sync
center text screen width()/2,(screen height()-text height(t$))/2,t$
endwhile
end
endif
for i=1 to 4
ode update
next i
for x=0 to width1-1
for y=0 to height1-1
nx=x+rnd(2)-1
if nx>width1-1
nx=width1-1
endif
if nx<0
nx=0
endif
ny=y+rnd(2)-1
if ny>height1-1
ny=height1-1
endif
if ny<0
ny=0
endif
write memblock byte 1,(y*width1+x)*4+13,memblock byte(1,(ny*width1+nx)*4+13)
next y
next x
make image from memblock 1,1
for x=0 to width2-1
r=rnd(255)
write memblock dword 2,((height2-1)*width2+x)*4+12,rgb(r,rnd(r/2),0)
for y=0 to height2-2
write memblock dword 2,(y*width2+x)*4+12,rgb(memblock byte(2,((y+1)*width2+x)*4+14)*.95,memblock byte(2,((y+1)*width2+x)*4+13)*.95,0)
next y
next x
make image from memblock 2,2
box screen width()/2-20,screen height()/2-1,screen width()/2+20,screen height()/2+1
box screen width()/2-1,screen height()/2-20,screen width()/2+1,screen height()/2+20
if mouseclick()=1
p=pick object(screen width()/2,screen height()/2,1,odeobjs)
if p>3
ode set linear velocity p,sin(camera angle y())*10,25,cos(camera angle y())*10
endif
endif
if object collision(3,0)>3
dec health
if health<0
delete objects 1,odeobjs
while escapekey()=0
sync
center text screen width()/2,(screen height()-text height("You died."))/2,"You died."
endwhile
end
endif
endif
endwhile
end
function create_vertex(memnum,v,vposx#,vposy#,vposz#,color as dword,u#,v#)
write memblock float memnum,v*36+12,vposx#
write memblock float memnum,v*36+16,vposy#
write memblock float memnum,v*36+20,vposz#
write memblock dword memnum,v*36+36,color
write memblock float memnum,v*36+40,u#
write memblock float memnum,v*36+44,v#
endfunction
Compressed code-
sync on : sync rate 0 : hide mouse : randomize timer() : disable escapekey : set text opaque : autocam off : set camera range 0.01,1000 : color backdrop 0 : while xtiles/2=xtiles/2.0 or xtiles<5 : print "Value must be odd and atleast 5" : sync : input "X tiles ",xtiles : if escapekey()=1 : end : endif : endwhile : while ytiles/2=ytiles/2.0 or ytiles<5 : print "Value must be odd and atleast 5" : sync : input "Y tiles ",ytiles : if escapekey()=1 : end : endif : endwhile
cls : counter=2*xtiles+2*ytiles-2 : dim maze(xtiles,ytiles) as boolean : for x=1 to xtiles : maze(x,1)=1 : maze(x,ytiles)=1 : next x : for y=1 to ytiles : maze(1,y)=1 : maze(xtiles,y)=1 : next y : max=(xtiles*ytiles)-((xtiles-2)*(ytiles-2)-((xtiles-3)/2)*(ytiles-3))+2 : xs#=screen width()/(xtiles+0.0) : ys#=screen height()/(ytiles+0.0) : while counter<max and escapekey()=0 : x=rnd(xtiles-2)+1 : y=rnd(ytiles-2)+1 : if maze(x-1,y-1)=1 and maze(x-1,y)+maze(x,y-1)=0 or maze(x-1,y+1)=1 and maze(x-1,y)+maze(x,y+1)=0 or maze(x+1,y-1)=1 and maze(x+1,y)+maze(x,y-1)=0 or maze(x+1,y+1)=1 and maze(x+1,y)+maze(x,y+1)=0 or maze(x,y)=1 or x/2.0=x/2 and y/2.0=y/2 or maze(x-1,y)+maze(x+1,y)+maze(x,y-1)+maze(x,y+1)<>1 : else : maze(x,y)=1 : inc counter : endif : if spacekey()=1 : text 0,0,left$(str$(counter/(max+0.0)*100),4)+"% done" : sync
endif : endwhile : cls : make memblock 1,12+(36*((max-1)*30-24)) : write memblock dword 1,0,338 : write memblock dword 1,4,36 : write memblock dword 1,8,(max-1)*30-24 : width=xtiles*10 : height=ytiles*10 : dh=10 : for x=1 to xtiles : for y=1 to ytiles : if maze(x,y)=1 : create_vertex(1,vertex,(x-1)*width/(xtiles+0.0),dh,(y-1)*height/(ytiles+0.0),rgb(255,255,255),0,0) : create_vertex(1,vertex+1,(x-1)*width/(xtiles+0.0),dh,y*height/(ytiles+0.0),rgb(255,255,255),0,1) : create_vertex(1,vertex+2,x*width/(xtiles+0.0),dh,(y-1)*height/(ytiles+0.0),rgb(255,255,255),1,0) : create_vertex(1,vertex+3,x*width/(xtiles+0.0),dh,(y-1)*height/(ytiles+0.0),rgb(255,255,255),1,0) : create_vertex(1,vertex+4,(x-1)*width/(xtiles+0.0),dh,y*height/(ytiles+0.0),rgb(255,255,255),0,1) : create_vertex(1,vertex+5,x*width/(xtiles+0.0),dh,y*height/(ytiles+0.0),rgb(255,255,255),1,1) : create_vertex(1,vertex+6,(x-1)*width/(xtiles+0.0),0,y*height/(ytiles+0.0),rgb(255,255,255),0,0) : create_vertex(1,vertex+7,x*width/(xtiles+0.0),dh,y*height/(ytiles+0.0),rgb(255,255,255),1,1) : create_vertex(1,vertex+8,(x-1)*width/(xtiles+0.0),dh,y*height/(ytiles+0.0),rgb(255,255,255),0,1) : create_vertex(1,vertex+9,x*width/(xtiles+0.0),0,y*height/(ytiles+0.0),rgb(255,255,255),1,0)
create_vertex(1,vertex+10,x*width/(xtiles+0.0),dh,y*height/(ytiles+0.0),rgb(255,255,255),1,1) : create_vertex(1,vertex+11,(x-1)*width/(xtiles+0.0),0,y*height/(ytiles+0.0),rgb(255,255,255),0,0) : create_vertex(1,vertex+12,(x-1)*width/(xtiles+0.0),0,(y-1)*height/(ytiles+0.0),rgb(255,255,255),0,0) : create_vertex(1,vertex+13,(x-1)*width/(xtiles+0.0),dh,(y-1)*height/(ytiles+0.0),rgb(255,255,255),0,1) : create_vertex(1,vertex+14,x*width/(xtiles+0.0),dh,(y-1)*height/(ytiles+0.0),rgb(255,255,255),1,1) : create_vertex(1,vertex+15,x*width/(xtiles+0.0),0,(y-1)*height/(ytiles+0.0),rgb(255,255,255),1,0) : create_vertex(1,vertex+16,(x-1)*width/(xtiles+0.0),0,(y-1)*height/(ytiles+0.0),rgb(255,255,255),0,0) : create_vertex(1,vertex+17,x*width/(xtiles+0.0),dh,(y-1)*height/(ytiles+0.0),rgb(255,255,255),1,1) : create_vertex(1,vertex+18,(x-1)*width/(xtiles+0.0),dh,(y-1)*height/(ytiles+0.0),rgb(255,255,255),1,0) : create_vertex(1,vertex+19,(x-1)*width/(xtiles+0.0),0,(y-1)*height/(ytiles+0.0),rgb(255,255,255),0,0) : create_vertex(1,vertex+20,(x-1)*width/(xtiles+0.0),0,y*height/(ytiles+0.0),rgb(255,255,255),0,1) : create_vertex(1,vertex+21,(x-1)*width/(xtiles+0.0),dh,y*height/(ytiles+0.0),rgb(255,255,255),1,1)
create_vertex(1,vertex+22,(x-1)*width/(xtiles+0.0),dh,(y-1)*height/(ytiles+0.0),rgb(255,255,255),1,0) : create_vertex(1,vertex+23,(x-1)*width/(xtiles+0.0),0,y*height/(ytiles+0.0),rgb(255,255,255),0,1) : create_vertex(1,vertex+24,x*width/(xtiles+0.0),dh,(y-1)*height/(ytiles+0.0),rgb(255,255,255),1,0) : create_vertex(1,vertex+25,x*width/(xtiles+0.0),0,y*height/(ytiles+0.0),rgb(255,255,255),0,1) : create_vertex(1,vertex+26,x*width/(xtiles+0.0),0,(y-1)*height/(ytiles+0.0),rgb(255,255,255),0,0) : create_vertex(1,vertex+27,x*width/(xtiles+0.0),dh,y*height/(ytiles+0.0),rgb(255,255,255),1,1) : create_vertex(1,vertex+28,x*width/(xtiles+0.0),0,y*height/(ytiles+0.0),rgb(255,255,255),0,1) : create_vertex(1,vertex+29,x*width/(xtiles+0.0),dh,(y-1)*height/(ytiles+0.0),rgb(255,255,255),1,0) : inc vertex,30 : endif : next y : next x : create_vertex(1,vertex,0,0,0,rgb(255,255,255),0,0) : create_vertex(1,vertex+1,0,0,height,rgb(255,255,255),0,ytiles) : create_vertex(1,vertex+2,width,0,0,rgb(255,255,255),xtiles,0) : create_vertex(1,vertex+3,width,0,0,rgb(255,255,255),xtiles,0) : create_vertex(1,vertex+4,0,0,height,rgb(255,255,255),0,ytiles) : create_vertex(1,vertex+5,width,0,height,rgb(255,255,255),xtiles,ytiles)
make mesh from memblock 1,1 : ode start : ode set world gravity 0,-20,0 : ode set world step 0.05 : ode set world erp (0.2)*2.5 : ode set world cfm (10^-5)*2.5 : convert mesh to vertexdata 1 : make object 1,1,0 : ode create static triangle mesh 1 : delete memblock 1 : delete mesh 1 : set object cull 1,1 : set object normals 1 : width1=256 : height1=256 : make memblock 1,width1*height1*4+12 : write memblock dword 1,0,width1 : write memblock dword 1,4,height1 : write memblock dword 1,8,32 : for x=0 to width1-1 : for y=0 to height1-1 : write memblock dword 1,(y*width1+x)*4+12,rgb(0,rnd(255),0) : next y : next x : make image from memblock 1,1 : width2=64 : height2=64 : make memblock 2,width2*height2*4+12
write memblock dword 2,0,width2 : write memblock dword 2,4,height2 : write memblock dword 2,8,32 : for x=0 to width2-1 : for y=0 to height2-1 : write memblock dword 2,(y*width2+x)*4+12,rgb(0,0,0) : next y : next x : make image from memblock 2,2 : texture object 1,1 : make object sphere 2,10 : position object 2,10*xtiles-15,dh/2,10*ytiles-15 : color object 2,rgb(255,255,0) : position camera 15,5,15 : speed#=0.2 : make object cube 3,1 : hide object 3 : make object sphere 4,5 : texture object 4,2 : set object light 4,0 : odeobjs=100 : for obj=5 to odeobjs : instance object obj,4 : position object obj,rnd(width),25,rnd(height) : ode create dynamic sphere obj
next obj : position object 4,rnd(width),25,rnd(height) : ode create dynamic sphere 4 : health=100 : while escapekey()=0 : sync : text 0,0,"Health: "+str$(health) : px#=camera position x() : py#=camera position y() : pz#=camera position z() : x#=camera angle x() : xrotate camera 0 : move camera speed#*(upkey()-downkey()) : yrotate camera camera angle y()+90 : move camera speed#*(rightkey()-leftkey()) : rotate camera x#+mousemovey()/2.0,camera angle y()-90+mousemovex()/2.0,0 : if camera angle x()>90 : xrotate camera 90 : endif : if camera angle x()<-90 : xrotate camera -90 : endif : if intersect object(1,px#,py#,pz#,camera position x(),camera position y(),camera position z())>0 : position camera px#,py#,pz# : endif
position object 3,camera position x(),camera position y(),camera position z() : if object collision (2,3)=1 : delete objects 1,odeobjs : t$="You beat a "+str$(xtiles)+" X "+str$(ytiles)+" maze!!!" : while escapekey()=0 : sync : center text screen width()/2,(screen height()-text height(t$))/2,t$ : endwhile : end : endif : for i=1 to 4 : ode update : next i : for x=0 to width1-1 : for y=0 to height1-1 : nx=x+rnd(2)-1 : if nx>width1-1 : nx=width1-1 : endif : if nx<0 : nx=0 : endif : ny=y+rnd(2)-1 : if ny>height1-1 : ny=height1-1
endif : if ny<0 : ny=0 : endif : write memblock byte 1,(y*width1+x)*4+13,memblock byte(1,(ny*width1+nx)*4+13) : next y : next x : make image from memblock 1,1 : for x=0 to width2-1 : r=rnd(255) : write memblock dword 2,((height2-1)*width2+x)*4+12,rgb(r,rnd(r/2),0) : for y=0 to height2-2 : write memblock dword 2,(y*width2+x)*4+12,rgb(memblock byte(2,((y+1)*width2+x)*4+14)*.95,memblock byte(2,((y+1)*width2+x)*4+13)*.95,0) : next y : next x : make image from memblock 2,2 : box screen width()/2-20,screen height()/2-1,screen width()/2+20,screen height()/2+1 : box screen width()/2-1,screen height()/2-20,screen width()/2+1,screen height()/2+20 : if mouseclick()=1 : p=pick object(screen width()/2,screen height()/2,1,odeobjs) : if p>3 : ode set linear velocity p,sin(camera angle y())*10,25,cos(camera angle y())*10 : endif : endif : if object collision(3,0)>3
dec health : if health<0 : delete objects 1,odeobjs : while escapekey()=0 : sync : center text screen width()/2,(screen height()-text height("You died."))/2,"You died." : endwhile : end : endif : endif : endwhile : end
function create_vertex(memnum,v,vposx#,vposy#,vposz#,color as dword,u#,v#)
write memblock float memnum,v*36+12,vposx# : write memblock float memnum,v*36+16,vposy# : write memblock float memnum,v*36+20,vposz# : write memblock dword memnum,v*36+36,color : write memblock float memnum,v*36+40,u# : write memblock float memnum,v*36+44,v#
endfunction