Hi, everyone!
I'm a longtime DBPro Owner, longtime forum lurker, and shorttime coder w/this software. I've been making excellent progress on working through tutorials and trying to cobble together my own simple games. However, I've hit something of a brick wall with a bit of code and weird behavior that has me stumped. I'm sure all of you experienced folks will see in two seconds what has had me argh!ing for a couple hours now. Anyhow, here's the code in question:
FUNCTION PlaceNormalMap() ` Function governing the placement of a pre-genned map and its tiles
MapSprite=1
REM This loop reads through the above DATA statement and puts the tiles on the screen, accordingly.
FOR Y=(MyScreen.ScreenYRes/2)-((MapHeight/2)*TileSize) TO (MyScreen.ScreenYRes/2)+((MapHeight/2)*TileSize)-1 STEP TileSize
FOR X=(MyScreen.ScreenXRes/2)-((MapWidth/2)*TileSize) TO (MyScreen.ScreenXRes/2)+((MapWidth/2)*TileSize)-1 STEP TileSize
READ MyTileType ` Reads in the sequence of data statements above
SPRITE MapSprite, X, Y, MyTileType ` Enumerates tiles and their positions using DATA
Inc MapSprite
NEXT X
NEXT Y
RESTORE ` Starts back at the beginning for DATA statements to reprint the map each time.
ENDFUNCTION
Now, as background, I'm using a series of data statements to show the order of tiles on a small map I'm using for my prototype and the included code is supposed to go through those statements and deliver those tiles on the screen. The tiles are in their proper places and I thought all was well... until I discovered that my MapSprite variable is being mangled in the process. Seems like the first two 'columns' of my map tiles seem to have the same sprite # when I run a little code to check their ids. Each tile is supposed to have a unique, predictable MapSprite value.
I'd appreciate any help you can give! Thanks in advance.