here's the modified 3 dimensional array for 5 layers. Layer 2 is even with the character. I am going to release the completed code for the tile engine, mapmaker, and sample rpg when it's complete.
remstart
Tile Engine sample: Programmed by Edward Jomisko 2/2003
remend
goto init
rem //////////////////////////////////////////////////////////////
rem // //
rem // Initialize Game variables & objects //
rem // //
rem //////////////////////////////////////////////////////////////
rem --------------------------------------------------------------
rem ////////////////////// INIT //////////////////////////////
init:
rem //// game flags ////
rem boolean logic: 0=FALSE a 1=TRUE
FL_GameDone=0 ; rem flag to end game
FL_BattleOver=0; rem flag to end battle mode
FL_Success=0; rem flag to signify a FL_Successful attack
FL_Moved=0; rem flag to signify if the player was able to move
FL_Walkable=0; rem flag to signify if the tile the player is moving to is FL_Walkable
sync rate 60; rem sets frame rate to 30 frames per second
sync on
rem **** Index into world array to be displayed ****
LeftMost=0
TopMost=0
RightMost=9
BottomMost=9
rem **** The max limits for the 10x10 grid ****
MaxRight=7
MaxLeft=2
MaxUp=2
MaxDown=7
rem **** WORLD CONSTANTS ****
TileSize=39; rem Size of each tile is 40 (0-39)
sx=0; rem sx is starting x position of tilebox
sy=0; rem sy is starting y position of tilebox
ex=TileSize; rem ex is ending x position of tilebox
ey=TileSize; rem ey is ending y position of tilebox
WorldSizeX=20; rem amount of tiles in the x-axis of world
WorldSizeY=20; rem amount of tiles in the y-axis of world
WorldHeightZ=5; rem amount of layers in the z-axis of world
dim Ar_World(WorldSizeX,WorldSizeY,WorldHeightZ)
rem **** LOAD TILE-WORLD BMP'S ****
load image "ice01.bmp" ,500
load image "mossy01.bmp" ,502
load image "grass.bmp" ,501
load image "pave11.bmp",503
rem **** LOAD WORLD FROM DATA ****
restore worlddata; rem restore data pointer to label worlddata
for IndexZ=0 to WorldHeightZ-1
for IndexY=0 to WorldSizeY-1
for IndexX=0 to WorldSizeX-1
read Val
Ar_World(IndexX,IndexY,IndexZ) =Val
next IndexX
next IndexY
next IndexZ
rem ////////////////// END OF INIT /////////////////////////
rem --------------------------------------------------------------
rem /////////////////////////////////////////////////////////////////
rem // //
rem // F U N C T I O N S //
rem // //
rem /////////////////////////////////////////////////////////////////
rem ------------------------------------------------------------------
rem =========================================================================================================
rem =========================================================================================================
rem ////////////////////////////////////////////////////////
rem //
rem // GAME LOOP ACTAULLY BEGINS HERE!!!! //
rem //
rem ////////////////////////////////////////////////////////
rem ------------------------------------------------------------------
rem ///////////////// M A I N ///////////////////////////
main:
while FL_GameDone<>1
rem **** Turn sync on to set framerate ****
sync
rem **** Draw the game world ****
for IndexZ=0 to WorldHeightZ-1
for IndexY=TopMost to BottomMost
for IndexX=LeftMost to RightMost
tile=Ar_World(IndexX,IndexY,IndexZ)
select tile
case 0: TileNum=500: endcase
case 1: TileNum=501: endcase
case 2: TileNum=502: endcase
case 3: TileNum=503: endcase
if TileNum<>500
paste image TileNum,sx,sy
endif
endselect
sx=sx+TileSize; ex=ex+TileSize
next IndexX
sx=0; ex=39
sy=sy+39; ey=ey+39
next IndexY
sy=0
next IndexZ
rem **** Draw Border ****
ink rgb(255,255,255),1
line 0,0,0,391
line 0,0,391,0
line 0,391,391,391
line 391,0,391,391
rem **** Display character info ****
rem **** Update player locationc ****
rem **** Check for monster encounter ****
rem **** Reset data for next frame ****
sx=0
sy=0
ex=39
ey=39
FL_Moved=0
endwhile
end
rem /////////////////////////////////////////////////////////////////
rem // //
rem // END OF GAME LOOP //
rem // //
rem /////////////////////////////////////////////////////////////////
rem
rem ===========================================================================================================
rem ===========================================================================================================
rem ----------------------------------------------------------------------
rem --------------------------------------------------------------------
rem -- --
rem -- G A M E D A T A --
rem -- --
rem --------------------------------------------------------------------
worlddata:
rem layer 0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
data 0,0,0,0,0,0,0,0,0,0,0,0,0,0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