Tilesets & RPG maps

BlitzMax Forums/BlitzMax Programming/Tilesets & RPG maps

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Why would you draw the tiles into a new image and then draw that, when you could draw the tiles directly to the screen in the first place? If you load the tiles as an anim image, you can then use the frame number to determine which tile to draw.

That is Exactly what ive done, and working. But i was told i could optimize that, however, i dont know how. Having looked at the given example i didnt see how that would optimize it.

Here, before we lose track, this is what i have:
Type TTileset
	Field image:TImage
	Field width:Int
	Field height:Int
	 
	Method Open(file:String) 
		Local image:TImage = LoadImage(file) 
		Self.width = ImageWidth(image) 
		Self.height = ImageHeight(image) 
		Self.image = LoadAnimImage(file, 32, 32, 0, (Self.width / 32) * (Self.height / 32)) 
	End Method
End Type

Function DrawTile(tile:Int, x:Int, y:Int, z:Int, oX:Int, oY:Int) 
	If z = 1 And tile = 0 DrawImage(ts.image, (x * 32) - oX, (y * 32) - oY, 31) 
	'If z<>5 And z<>8 And  
	If tile > 0 DrawImage(ts.image, (x * 32) - oX, (y * 32) - oY, tile - 1) 
End Function

ts:TTileset=new TTileset
etc...
++START DRAW LOOP++
DrawTile(tile, x, y, 1, 0,0) 

++END DRAW LOOP++