This is what is supposed to happen: Blit 10 tiles (based on the order in 'MapData', one after the other.
This is what's happen: It will blit the last chosen tile 10 times, one after another. So it ends up showing tile number 10 ten times.
It does update all the coordinates, and if run in debug it also runs through every selected tile. But still decides to only blit the last tile selected in the cycle (after ten cycles). It will wait till after the last cycle before it blitz anything on screen.
Any ideas?
Part of program:
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Type TTile Extends TGameObject
Function Create:TTile (Image:TImage,xstart:Int,ystart:Int)
Local obj:TTile =New TTile
CreateObject(obj,Image,xstart,ystart)
Return obj
End Function
Method UpdateSelf()
If GameState<>PLAY Then Return
Frame = ChosenTile 'ChosenTile is a Global
EndMethod
EndType
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function CreateTiles()
Local ChosenTilePosX:Int = -16
Local ChosenTilePosY:Int = 16
Local TileCounter:Int
Local LowNumber:Int
Local HighNumber:Int
'DebugStop
LowNumber = 1
HighNumber = LowNumber + 1
Local MapData [] = [0,1,2,3,13,13,13,13,14,15,2,2,2,16,17]
For Local LoopTheTiles:Int = 1 To 10
Local SelectedTile:Int [] = MapData [LowNumber..HighNumber]
For ChosenTile = EachIn SelectedTile
ChosenTilePosX :+32
LowNumber:+1
HighNumber:+1
'If ChosenTilePosX > Width Then
'ChosenTilePosX = 16
'ChosenTilePosY :+32
'EndIf
TTile.Create(LoadAnimImage("incbin::Gfx/Tiles/BlueWallTiles_32x32x256.png", 32, 32, 0, 95),ChosenTilePosX ,ChosenTilePosY )
Next
Next
EndFunction
|