I am currently in the process of developing a tile-map engine with the trial version of Dark Basic. I will be ordering the full version, but in the mean time...
My code is frustrating me. I have all the media files in their respective places (the same directory: is that so hard DB!). It reads the map.txt and my bitmaps and only displays my ship hovering across the black screen instead of the tiles that I meticulously designed.
Sometimes I even dsignate it a bitmap that I know has been extracted but the tiles prevail in their voidness.
Here is the entire code minus the loading of the bitmaps and the engine used to control the craft:
LOAD BITMAP "starfighter.bmp", 1
rem set it
set current bitmap 1
get image 1, 0,0,100,100
cls
LOAD BITMAP "explode.bmp",2
set current bitmap 2
rem this is an animation
FOR y=0 to 1
FOR x=0 TO 4
GET IMAGE 2+x+(y*5),(x*102),(y*100),(x*102)+102,(y*100)+100
NEXT x
NEXT y
cls
DELETE BITMAP 1
DELETE BITMAP 2
rem this is for tiles
LOAD BITMAP "tiles.bmp",3
set current bitmap 3
rem for loop for tile set
FOR x=0 TO 6
GET IMAGE 12+x,(x*39),0,(x*39)+39,39
NEXT x
rem this is for the map loader
12=image_start
mx=16
my=12
DIM LEVEL_MAP(mx,my)
rem load level
open to read 1,"map.txt"
rem load bits
FOR my=1 to 12
FOR mx=1 to 16
read byte 1,a
num=a+image_start
LEVEL_MAP(mx,my)=num
NEXT mx
NEXT my
close file 1
rem Activate manual syncronization
SYNC ON
rem initialize player position
player_x=200
player_y=200
rem Begin Loop
DO
FOR my=1 TO 12
FOR mx=1 TO 16
LEVEL_MAP(mx,my)=todo
paste image todo,(mx*39)-39,(my*39)-39
NEXT mx
NEXT my
rem record old position
oldx=player_x
oldy=player_y
rem YADDA YADDA YADDA About the ship movement
LOOP
END
Any help or comments greatly appreciated. This is my third project to learn the ways of Dark Basic. Oh, and yes, the map.txt file does go something like this:
4544454445442111
4544454445442111
4544454445447333
ect. ect.
"I need gopher-chucks!!"