I'm trying to draw a tile map using sprites. The map is stored in a two dimensional array cells(35,25). Each cell has a type (wall or floor) and sprite. Problem is that when i try to loop through the array and display every sprite, the program just shows a light grey screen. Sprites are displayed correctly if I display them "one at a time" by using multiple DisplaySprite()-commands, but not within a For-loop. Here's some code to explain my problem little more:
Works
Code: Select all
StartDrawing(ScreenOutput())
DisplaySprite(cells(0,0)\sprite,100,100)
DisplaySprite(cells(0,1)\sprite,200,200)
StopDrawing()
Doesn't work
Code: Select all
StartDrawing(ScreenOutput())
For x = 0 To #X_CELLS
For y = 0 To #Y_CELLS
If cells(x,y)\type = #WALL
DisplaySprite(cells(x,y)\sprite,x * #CELL_SIZE,y * #CELL_SIZE)
;Box(x * #CELL_SIZE,y * #CELL_SIZE,#CELL_SIZE,#CELL_SIZE,RGB(128,128,128))
EndIf
Next y
Next x
StopDrawing()