Always wanted to do a 3D puzzle well last night I stopped procrastinating and got to work
and wanted to show my progress it is very short but i took advantage of using includes so
to test it you will have to make a project and add the following files
Labrynth 3D
main.agc
// Project: maze gen v3
// Created: 2018-07-06
// show all errors
SetErrorMode(2)
#include "Declarations.agc"
#include "CreateMaze.agc"
// set window properties
SetWindowTitle( "Labrynth" )
SetWindowSize( swidth, sheight, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( swidth, sheight ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
createtexture(grassTexture,512,512, makecolor(55,155,55),256)
createWallTexture(wallTexture)
SetImageWrapU(grassTexture,1 )
SetImageWrapV(grassTexture,1 )
CreateSprite(playerSpr,0)
SetSpriteImage(playerSpr,createPlayerSprImage())
SetSpriteVisible(playerSpr,1)
SetSpriteSize(playerSpr,40,40) //:SetSpriteTransparency(playerSpr,1)
SetSpriteDepth(playerSpr,0)
CreateSprite(enemySpr,0)
SetSpriteImage(enemySpr,createEnemySprImage())
SetSpriteVisible(enemySpr,0)
SetSpriteSize(enemySpr,40,40)
SetSpriteDepth(enemySpr,0)
//CreateSprite(mapSpr,0)
//SetSpriteVisible(mapSpr,0)
//SetSpriteDepth(mapSpr,1)
global cols,rows,width
type _cells
ObjID0
ObjID1
ObjID2
ObjID3
x,y
walls as integer[3]
visited
current
direction
endtype
type _visit
x,y
time as float
endtype
global visited as _visit[]
global cells as _cells[]
//global emptycell as _cells
global stack as _cells[]
global stackcount, completed=0
global current=0
ground = CreateObjectBox(500,1,500)
SetObjectPosition(ground,0,-1.0,0)
SetObjectImage(ground,grassTexture,0)
SetObjectUVScale(ground,0,15, 15 )
CreateObjectBox(playerObj,1,1,1)
SetObjectPosition(playerObj,0,1.0,0)
SetObjectVisible(playerObj,0)
SetObjectCollisionMode(playerObj, 0 )
//emptyArrays()
createMaze(50)
emptyArrays()
loadmaze("Level1.Dat")
createWalls()
roof = CreateObjectBox(65,1,45)
SetObjectPosition(roof,30,4.0,20)
global viewmaze=1
CreateText(1,"Use Arrow keys to move around")
CreateText(2,"Press 'V' to toggle Maze View")
CreateText(textGameOver,"GameOver")
CreateText(textLevel,"GO")
SetTextSize(1,25):SetTextSize(2,25):SetTextSize(3,25)
SetTextPosition(1,0,690):SetTextPosition(2,0,715)
SetTextSize(textLevel,100)
SetTextPosition(textLevel,(sWidth*.5)-54,300)
SetTextColor(textLevel,0,255,0,255)
SetTextVisible(textLevel,1):iAlpha=255
SetTextColorAlpha(textLevel, iAlpha )
SetTextSize(textGameOver,100)
SetTextPosition(textGameOver,(sWidth*.5)-200,200)
SetTextColor(textGameOver,255,0,0,255)
SetTextVisible(textGameOver,0)
startTime#=Timer():ResetTimer()
flag=0
do
if viewmaze=1
//SetClearColor(0,0,0)
//ClearScreen()
//Render()
for x=0 to cells.length
xx = cells[x].x * width
yy = cells[x].y * width
if cells[x].walls[0]=1 then DrawLine(xx ,552-yy ,xx+width, 552-yy ,white,white)
if cells[x].walls[1]=1 then DrawLine(xx+width,552-yy ,xx+width, 552-(yy+width),white,white)
if cells[x].walls[2]=1 then DrawLine(xx+width,552-(yy+width),xx , 552-(yy+width),white,white)
if cells[x].walls[3]=1 then DrawLine(xx ,552-(yy+width),xx , 552-yy ,white,white)
next
for x=0 to visited.length
DrawBox((visited[x].x * width)+shrink,(552-(visited[x].y*width))-shrink,(visited[x].x*width+width)-shrink,(552-(visited[x].y*width+width))+shrink ,green,green,green,green,1)
next x: dec x
//if visited.length>0 then DrawBox((visited[x].x * width)+shrink,(552-(visited[x].y*width))-shrink,(visited[x].x*width+width)-shrink,(552-(visited[x].y*width+width))+shrink ,blue,blue,blue,blue,1)
//swap()
//if GetImageExists(mapImg) then DeleteImage(mapImg)
//getimage(mapImg,0,0,swidth-220,sheight-210)
//SetImageTransparentColor(mapImg,0,0,0)
//SetSpriteImage(mapSpr,mapImg)
//SetSpriteSize(mapSpr,swidth-220,sheight-210)
x#=GetObjectX(playerObj)/4.0:y#=(GetObjectZ(playerObj)/4.0)
//DrawBox(x# * width+2 ,y# * width+2 ,x#* width+width-2 ,y# * width+width - 2,blue,blue,blue,blue,1)
angle=GetObjectAngleY(playerObj) //:if angle = 0 or angle =180 then angle=angle + 180
SetSpriteAngle(playerSpr,angle)
SetSpritePositionByOffset(playerSpr,x#* width+(width*.5),552-(y#* width+(width*.5)))
endif
if startTime#+10<timer()
flag=1
if viewmaze=1 then SetSpriteVisible(enemySpr,1)
endif`
for num=0 to visited.length
if visited[num].time+.25<timer() and flag=1
x#=visited[num].x:y#=visited[num].y
SetSpritePositionByOffset(enemySpr,x#* width+(width*.5),552-(y#* width+(width*.5)))
visited.remove(num)
ResetTimer()
endif
next num
updatePlayerMovement()
if GetRawKeyPressed(KEY_V)
if viewmaze=1
viewmaze=0
SetSpriteVisible(playerSpr,0)
SetSpriteVisible(enemySpr,0)
//SetSpriteVisible(mapSpr,0)
else
viewmaze = 1
SetSpriteVisible(playerSpr,1)
SetSpriteVisible(enemySpr,1)
//SetSpriteVisible(mapSpr,1)
endif
endif
if GetSpriteCollision( playerSpr, enemySpr ) and flag=1
SetTextVisible(textGameOver,1)
repeat
Print("Press space to play again")
sync()
until GetRawKeyPressed(KEY_SPACE)
SetTextVisible(textGameOver,0)
SetObjectVisible(roof,0)
emptyArrays()
completed=0:current=0
createMaze(50)
emptyArrays()
loadmaze("Level1.Dat")
completed=0:current=0:flag=0
SetObjectPosition(playerObj,0,1.0,0)
createWalls()
SetObjectVisible(roof,1)
SetSpriteVisible(enemySpr,0)
x#=-20:y#=0
SetSpritePositionByOffset(enemySpr,x#* width+(width*.5),552-(y#* width+(width*.5)))
iAlpha=255:flag=0:startTime#=Timer():ResetTimer()
endif
if getObjectX(playerObj)>=59 and getObjectZ(playerObj)>=39
SetObjectVisible(roof,0)
emptyArrays()
completed=0:current=0
createMaze(50)
emptyArrays()
loadmaze("Level1.Dat")
completed=0:current=0:flag=0
SetObjectPosition(playerObj,0,1.0,0)
createWalls()
SetObjectVisible(roof,1)
SetSpriteVisible(enemySpr,0)
x#=-20:y#=0
SetSpritePositionByOffset(enemySpr,x#* width+(width*.5),552-(y#* width+(width*.5)))
iAlpha=255:flag=0:startTime#=Timer():ResetTimer()
endif
if iAlpha>2 then iAlpha=iAlpha-2
SetTextColorAlpha(textLevel, iAlpha )
SetCameraRotation(1,0,GetObjectWorldAngleY(playerObj),GetObjectWorldAngleZ(playerObj) )
SetCameraPosition(1,GetObjectWorldX(playerObj),GetObjectWorldY(playerObj)+camOff_y#,GetObjectWorldZ(playerObj))
Sync()
loop
function loadmaze(mazefile as string)
loadfile = OpenToRead(mazefile)
length = ReadInteger(loadfile)
width = ReadInteger(loadfile)
cells.length = length
for loops = 0 to length
cells[loops].x = ReadInteger(loadfile)
cells[loops].y = ReadInteger(loadfile)
cells[loops].walls[0] = ReadInteger(loadfile)
cells[loops].walls[1] = ReadInteger(loadfile)
cells[loops].walls[2] = ReadInteger(loadfile)
cells[loops].walls[3] = ReadInteger(loadfile)
next
CloseFile(loadfile)
endfunction
function createWalls()
for a=0 to cells.length
//change 4 to 5 for no more gaps
if cells[a].walls[0] = 1 // top or bottom
//cells[a].ObjID = InstanceObject(playerObj)
cells[a].ObjID0=CreateObjectBox(1,wallheight,1)
SetObjectPosition(cells[a].ObjID0, cells[a].x*4, 1, cells[a].y*4-2)
SetObjectScale(cells[a].ObjID0, 5,1,1)
SetObjectImage(cells[a].ObjID0,wallTexture,0)
SetObjectCollisionMode( cells[a].ObjID0, 1 )
endif
if cells[a].walls[2] = 1 // top or bottom
//cells[a].ObjID = InstanceObject(playerObj)
cells[a].ObjID1=CreateObjectBox(1,wallheight,1)
SetObjectPosition(cells[a].ObjID1, cells[a].x*4, 1, cells[a].y*4+2)
SetObjectScale(cells[a].ObjID1, 5,1,1)
SetObjectImage(cells[a].ObjID1,wallTexture,0)
SetObjectCollisionMode( cells[a].ObjID1, 1 )
endif
if cells[a].walls[1] = 1 // left or right
//cells[a].ObjID = InstanceObject(playerObj)
cells[a].ObjID2=CreateObjectBox(1,wallheight,1)
SetObjectPosition(cells[a].ObjID2, cells[a].x*4+2, 1, cells[a].y*4)
SetObjectRotation(cells[a].ObjID2, 0,90,0)
SetObjectScale(cells[a].ObjID2,5,1,1)
SetObjectImage(cells[a].ObjID2,wallTexture,0)
SetObjectCollisionMode( cells[a].ObjID2, 1 )
endif
if cells[a].walls[3] = 1 // left or right
//cells[a].ObjID = InstanceObject(playerObj)
cells[a].ObjID3=CreateObjectBox(1,wallheight,1)
SetObjectPosition(cells[a].ObjID3, cells[a].x*4-2, 1, cells[a].y*4)
SetObjectRotation(cells[a].ObjID3, 0,90,0)
SetObjectScale(cells[a].ObjID3,5,1,1)
SetObjectImage(cells[a].ObjID3,wallTexture,0)
SetObjectCollisionMode( cells[a].ObjID3, 1 )
endif
next
endfunction
function createWallTexture(img as integer)
ClearScreen()
Render()
DrawBox(0,0,64,64,MakeColor(155,155,155),MakeColor(155,155,155),MakeColor(155,155,155),MakeColor(155,155,155),1)
x=-5:y=0:oldX=0
repeat
repeat
DrawBox(x,y,x+5,y+1,MakeColor(155,5,5),MakeColor(155,5,5),MakeColor(155,5,5),MakeColor(155,5,5),1)
x=x+6
until x>64+5
if oldx=-5
x=-2:oldx=-2
else
x=-5:oldx=-5
endif
y=y+3
until y>64+2
Swap()
getimage(img,0,0,64,64)
sync()
endfunction
//used to create grass texture
function createtexture(imgID as integer,sizex# as float, sizey# as float, color, density as integer)
swap()
drawbox(0,0,sizex#, sizey#, color, color,color,color, 1)
render()
img = getimage(0,0,sizex#, sizey#)
memblockid = CreateMemblockFromImage (img)
imgwidth = GetMemblockInt(memblockid, 0)
imgheight = GetMemblockInt(memblockid, 4)
size=GetMemblockSize(memblockid)
for offset=12 to size-4 step 4
r=GetMemblockByte(memblockid, offset)
g=GetMemblockByte(memblockid, offset+1)
b=GetMemblockByte(memblockid, offset+2)
a=GetMemblockByte(memblockid, offset+3)
strength=random(1,density)
SetMemblockByte (memblockid, offset, r-strength)
SetMemblockByte (memblockid, offset+1, g-strength)
SetMemblockByte (memblockid, offset+2, b-strength )
SetMemblockByte (memblockid, offset+3, a-strength)
next
deleteimage (img)
CreateImageFromMemblock(imgID,memblockid)
DeleteMemblock(memblockid)
endfunction
function createPlayerSprImage()
rem draw a triangle image used for the player sprite on radar
SetClearColor(0,0,0)
ClearScreen()
Render()
DrawLine(5,0,9,9,green,green)
DrawLine(1,8,8,8,green,green)
DrawLine(1,9,5,0,green,green)
//DrawLine(5,0,5,9,green,green)
//draw these if you want it filled
DrawLine(4,0,8,9,green,green)
DrawLine(0,9,8,9,green,green)
DrawLine(0,9,4,0,green,green)
DrawBox(4,1,6,8,green,green,green,green,1)
swap()
img = getimage(0,0,10,10)
SetImageTransparentColor(img,0,0,0)
endfunction img
function createEnemySprImage()
rem draw a triangle image used for the player sprite on radar
SetClearColor(0,0,0)
ClearScreen()
Render()
DrawEllipse(6,6,4,4,yellow,yellow,0)
DrawEllipse(6,6,3,3,yellow,yellow,0)
swap()
img = getimage(0,0,12,12)
SetImageTransparentColor(img,0,0,0)
endfunction img
function updatePlayerMovement()
if GetRawKeyPressed(KEY_LEFT)
RotateObjectLocalY(playerObj,-90)
endif
if GetRawKeyPressed(KEY_RIGHT)
RotateObjectLocalY(playerObj,90)
endif
if GetRawKeyState(KEY_UP) //move forward
old_x#=getObjectWorldX(playerObj)
old_y#=GetObjectWorldY(playerObj)
old_z#=getObjectWorldZ(playerObj)
MoveObjectLocalZ(playerObj,2 )
if checkCollision(playerObj)>0
SetObjectPosition(playerObj,old_x#,old_y#,old_z# )
endif
visits as _visit
visits.x=getObjectWorldX(playerObj)/4.0
visits.y=getObjectWorldZ(playerObj)/4.0
visits2.time=timer()
visited.insert(visits)
endif
if GetRawKeyState(KEY_DOWN) //move backwards
old_x#=getObjectWorldX(playerObj)
old_y#=GetObjectWorldY(playerObj)
old_z#=getObjectWorldZ(playerObj)
MoveObjectLocalZ(playerObj,-2 )
if checkCollision(playerObj)>0
SetObjectPosition(playerObj,old_x#,old_y#,old_z# )
endif
visits2 as _visit
visits2.x=getObjectWorldX(playerObj)/4.0
visits2.y=getObjectWorldZ(playerObj)/4.0
visits2.time=timer()
visited.insert(visits2)
endif
if GetrawkeyPressed(KEY_SPACE) or GetRawMouseRightPressed() //jump
Jump3DPhysicsCharacterController(playerObj)
endif
if GetrawkeyPressed(KEY_ENTER) or GetPointerPressed() //shoot
//ThrowBall( 1000.0, 10.0)
endif
endfunction
function checkCollision(object as integer)
//this checks for colliion between an object with any other object and returns its id
width#=1
height#=1
depth#=1
x#=getObjectWorldX(object)
y#=GetObjectWorldY(object)
z#=getObjectWorldZ(object)
// calculate the start of the ray cast
start_x# = x#-width#
start_y# = y#+height#
start_z# = z#-depth#
// calculate the end of the ray cast
end_x# = x#+width#
end_y# = y#-height#
end_z# = z#+depth#
// determine which object has been hit
object_hit = ObjectRayCast(0,start_x#,start_y#,start_z#,end_x#,end_y#,end_z#)
endfunction object_hit
function emptyArrays()
num2=cells.length
for num=num2 to 0 step -1
DeleteObject(cells[num].ObjID0):DeleteObject(cells[num].ObjID1)
DeleteObject(cells[num].ObjID2):DeleteObject(cells[num].ObjID3)
cells.remove(num)
next
num2=visited.length
for num=num2 to 0 step -1
visited.remove(num)
next num
num2=stack.length
for num=num2 to 0 step -1
stack.remove(num)
next num
endfunction
Declarations.agc
#constant KEY_BACK = 8
#constant KEY_TAB = 9
#constant KEY_ENTER = 13
#constant KEY_SHIFT = 16
#constant KEY_CONTROL = 17
#constant KEY_ESCAPE = 27
#constant KEY_SPACE = 32
#constant KEY_PAGEUP = 33
#constant KEY_PAGEDOWN = 34
#constant KEY_END = 35
#constant KEY_HOME = 36
#constant KEY_LEFT = 37
#constant KEY_UP = 38
#constant KEY_RIGHT = 39
#constant KEY_DOWN = 40
#constant KEY_INSERT = 45
#constant KEY_DELETE = 46
#constant KEY_0 = 48
#constant KEY_1 = 49
#constant KEY_2 = 50
#constant KEY_3 = 51
#constant KEY_4 = 52
#constant KEY_5 = 53
#constant KEY_6 = 54
#constant KEY_7 = 55
#constant KEY_8 = 56
#constant KEY_9 = 57
#constant KEY_A = 65
#constant KEY_B = 66
#constant KEY_C = 67
#constant KEY_D = 68
#constant KEY_E = 69
#constant KEY_F = 70
#constant KEY_G = 71
#constant KEY_H = 72
#constant KEY_I = 73
#constant KEY_J = 74
#constant KEY_K = 75
#constant KEY_L = 76
#constant KEY_M = 77
#constant KEY_N = 78
#constant KEY_O = 79
#constant KEY_P = 80
#constant KEY_Q = 81
#constant KEY_R = 82
#constant KEY_S = 83
#constant KEY_T = 84
#constant KEY_U = 85
#constant KEY_V = 86
#constant KEY_W = 87
#constant KEY_X = 88
#constant KEY_Y = 89
#constant KEY_Z = 90
#constant KEY_F1 = 112
#constant KEY_F2 = 113
#constant KEY_F3 = 114
#constant KEY_F4 = 115
#constant KEY_F5 = 116
#constant KEY_F6 = 117
#constant KEY_F7 = 118
#constant KEY_F8 = 119
#constant wallTexture = 1
#constant grassTexture = 2
#constant mapImg = 3
#constant playerObj = 500 //object ID of player
#constant playerGunObj = 501//The player gun object ID its invisible but location is used to shoot from
#constant playerSpr = 1 //Player sprite on the map
#constant enemySpr = 2
#constant mapSpr = 3
#constant textLevel = 3
#constant textGameOver = 4
#constant shrink = 20 //a value used to shrink the size of the draw boxes
#constant camOff_y# = 0 //Camera y offset
#constant swidth = 1024
#constant sheight = 768
#constant white = MakeColor(0,0,255)
#constant green = MakeColor(0,255,0)
#constant blue = MakeColor(0,0,255)
#constant yellow = MakeColor(255,255,0)
#constant black = MakeColor(0,0,0)
#constant wallheight = 5
CreateMaze.agc
function createMaze(width)
// Change this value - lower the larger the map - the higher to smaller the maze
//width = 50
// Change this value - lower the larger the map - the higher to smaller the maze
completed=0
cols = floor(swidth / width)-5
rows = floor (sheight /width)-5
current=0
initialisegrid()
//currentcell.insert (cells[current])
saved=0
repeat
//if viewmaze=1
for x=0 to cells.length
xx = cells[x].x * width
yy = cells[x].y * width
if completed=0 and cells[x].visited = 1 then DrawBox(xx ,552-yy ,xx+width, 552-(yy+width),green,green,green,green,1)
if cells[x].walls[0]=1 then DrawLine(xx ,552-yy ,xx+width, 552-yy ,white,white)
if cells[x].walls[1]=1 then DrawLine(xx+width,552-yy ,xx+width, 552-(yy+width),white,white)
if cells[x].walls[2]=1 then DrawLine(xx+width,552-(yy+width),xx , 552-(yy+width),white,white)
if cells[x].walls[3]=1 then DrawLine(xx ,552-(yy+width),xx , 552-yy ,white,white)
next
DrawBox(cells[current].x * width+2 ,552-(cells[current].y * width+2) ,cells[current].x * width+width-2 ,552-(cells[current].y * width+width - 2),blue,blue,blue,blue,1)
//endif
checkneighbours(cells[current])
cells[current].visited=1
if completed=1
// lets save the current maze out
if saved=0
cells[current].walls[0]=0
cells[current].walls[1]=0
cells[current].walls[2]=0
cells[current].walls[3]=0
saved=1
if GetFileExists("level1.dat") then DeleteFile("level1.dat")
savefile = OpenToWrite("level1.dat")
WriteInteger(savefile,cells.length)
WriteInteger(savefile,width)
for loops = 0 to cells.length
WriteInteger(savefile,cells[loops].x)
WriteInteger(savefile,cells[loops].y)
WriteInteger(savefile,cells[loops].walls[0])
WriteInteger(savefile,cells[loops].walls[1])
WriteInteger(savefile,cells[loops].walls[2])
WriteInteger(savefile,cells[loops].walls[3])
next
CloseFile(savefile)
print("Saved")
sync()
sleep(1000)
endif
endif
Sync()
until saved=1
endfunction
function initialisegrid()
i=0
local emptycell as _cells
for x=0 to cols
for y=0 to rows
emptycell.current = i
emptycell.x = x
emptycell.y = y
emptycell.walls[0] = 1 //top
emptycell.walls[1] = 1 //right
emptycell.walls[2] = 1 //bottom
emptycell.walls[3] = 1 // left
emptycell.visited = 0
cells.insert(emptycell)
inc i
next
next
endfunction
function checkneighbours(cell ref as _cells)
neighbours as _cells[]
top as _cells
cright as _cells
cleft as _cells
cbottom as _cells
r as _cells
//top
if index(cell.x, cell.y-1) <> -1 and cells[index(cell.x, cell.y-1)].visited = 0
top = cells[index(cell.x, cell.y - 1)]
top.current = index(cell.x, cell.y - 1)
top.visited=1
top.direction=0
neighbours.insert(top)
endif
//right
if index(cell.x+1,cell.y) <> -1 and cells[index(cell.x+1, cell.y)].visited = 0
cright = cells[index(cell.x+1, cell.y)]
cright.current = cells[index(cell.x+1, cell.y)].current
cright.visited=1
cright.direction=1
neighbours.insert(cright)
endif
// bottom
if index(cell.x, cell.y+1) <> -1 and cells[index(cell.x, cell.y+1)].visited = 0
cbottom = cells[index(cell.x, cell.y + 1)]
cbottom.current = index(cell.x, cell.y + 1)
cbottom.visited=1
cbottom.direction = 2
neighbours.insert(cbottom)
endif
//left
if index(cell.x-1,cell.y) <> -1 and cells[index(cell.x-1, cell.y)].visited = 0
cleft = cells[index(cell.x-1, cell.y)]
cleft.current = index(cell.x-1, cell.y)
cleft.visited=1
cleft.direction = 3
neighbours.insert(cleft)
endif
oldc=current
if neighbours.length>=0
r = neighbours[floor(random(0,neighbours.length))]
// remove necessary walls that your heading towards
select (r.direction)
case 0: //up /top
cells[index(cell.x,cell.y)].walls[0]=0
cells[index(cell.x,cell.y-1)].walls[2]=0
endcase
case 1: // right
cells[index(cell.x,cell.y)].walls[1]=0
cells[index(cell.x+1,cell.y)].walls[3]=0
endcase
case 2: // bottom / down
cells[index(cell.x,cell.y)].walls[2]=0
cells[index(cell.x,cell.y+1)].walls[0]=0
endcase
case 3: // left
cells[index(cell.x,cell.y)].walls[3]=0
cells[index(cell.x-1,cell.y)].walls[1]=0
endcase
endselect
current = r.current
stack.insert (r)
inc stackcount
else
if stackcount-1<0
print ("COMPLETED")
completed = 1
else
cells[index(r.x,r.y)] = stack[stackcount-1]
current = index(r.x,r.y)
stack.remove(stackcount-1)
dec stackcount
endif
endif
for num=0 to neighbours.length
num2=num:neighbours.remove(num2)
next num
endfunction r
function index ( i, j )
if (i <0 or j <0 or i > cols or j > rows )
else
returnvalue = (i * (rows+1)) + j
endif
endfunction returnvalue
I had to invert the maze drawing so as rotations of sprites would be correct etc
How to play
Start at bottom left of maze and work your way to top right corner
If you take to long a munchkin will eat you he eats everything in site
including the trail of bread crumbs you leave behind
The maze is generated real time i still need to not use the save load method
I am currently using
fubar