Tile Guru

Miscellaneous Forums/Blitz Showcase/Tile Guru



It's a simple tile map editor that should suit the needs of anyone whose making a simpler tile map project.
Features:
- Up to 10 different layers
- Transparency effects
- No tile size limits

It still has a few bugs (see the VersionHistory.txt file) which I will try to fix later, but nothing that really makes it unuseable.

The Download: http://www.paulleduc.com/files/TileGuru1-0.zip (286 Kb)

It runs in Direct X. I had some graphical problems on another computer but I assume it's because it's a bad computer...

Here's some example code for opening a .tgm file:
'example of loading a .tgm file for use in a project
'coded for use with a .tgm file created with Tile Guru 0.6b

SuperStrict

Graphics 640,480,0

Local file$="maps/BerralPyramid.tgm"	'the .tgm file you want to load

Local in:TStream=OpenStream(file$)	'read the file
							
	Local FileVersion$=ReadLine(in)	'read the version of Tile Guru that the map was made with
	Local TileSet$=ReadLine(in)		'read the tileset image that was used in the map 
	Local TileWidth:Int=ReadInt(in)	'read the width of each tile in pixels
	Local TileHeight:Int=ReadInt(in)'read the height of each tile in pixels
	Local Frames:Int=ReadInt(in)	'read the number of frames that the tileset has
	Local TilesAcross:Int=ReadInt(in)'read the number of tiles across the map
	Local TilesDown:Int=ReadInt(in)	'read the number of tiles down the map
	Local Layers:Int=ReadInt(in)	'read the number of layers the map uses
	
	Global map:tilemap=tilemap.Create(TileWidth,TileHeight,TileSet$,TilesAcross,TilesDown,Frames,Layers)	''Create' the tile map (see below)
	
	For Local l:Int=0 To Layers-1	'from 0 to the number of layers		
		For Local y:Int=0 To TilesDown-1	'from 0 to the number of tiles DOWN (y) the map		
			For Local x:Int=0 To TilesAcross-1	'from 0 to the number of tiles ACROSS (x) the map
				map.tiles[x,y,l].TileFrame=ReadInt(in)	'read each tile's frame and insert it into the array (see below)
			Next														
		Next	
	Next	
	
CloseStream(in) 'stop reading the file

While Not KeyHit(KEY_ESCAPE)	'main loop

	map.Draw(TilesAcross,TilesDown,TileWidth,TileHeight,Layers)	'draw all the tiles (see below)

	Flip;Cls
	
Wend

Type tilemap	'stores an array of all the tiles and stores the tileset image

	Field tset:TImage,tiles:tile[,,]	'set a blank array with 3 dimensions
	
	Method Draw(TilesAcross:Int,TilesDown:Int,TileWidth:Int,TileHeight:Int,Layers:Int)
	
		For Local l:Int=0 To Layers-1	'from 0 to the number of layers
			For Local x:Int=0 To TilesAcross-1	'from 0 to the number of tiles ACROSS (x) the map
				For Local y:Int=0 To TilesDown-1	'from 0 to the number of tiles DOWN (y) the map
					tiles[x,y,l].Draw(x*TileWidth,y*TileHeight)	'draw each tile at its respective position and layer (see below)
				Next
			Next		
		Next				
	
	End Method
	
	Function Create:tilemap(TileWidth:Int,TileHeight:Int,TileSet$,TilesAcross:Int,TilesDown:Int,Frames:Int,Layers:Int)
		
		Local tm:tilemap=New tilemap 'create a new tilemap object
			tm.tset=LoadAnimImage(TileSet$,TileWidth,TileHeight,0,Frames)	'load the tileset image
			tm.tiles=New tile[TilesAcross,TilesDown,Layers]	'create the array of the tile type (see below)
											
		For Local l:Int=0 To Layers-1	'from 0 to the number of layers
			For Local x:Int=0 To TilesAcross-1	'from 0 to the number of tiles ACROSS (x) the map
				For Local y:Int=0 To TilesDown-1	'from 0 to the number of tiles DOWN (y) the map							
					tm.tiles[x,y,l]=New tile	'create each tile object								
				Next
			Next
		Next
		
		Return tm					
		
	End Function
	
End Type

Type tile	'stores each tile's frame and draws them
	
	Field TileFrame:Int	'the tile's frame
	
	Method Draw(x:Int,y:Int)				
		
		SetColor(255,255,255)
		SetBlend(ALPHABLEND)	'enable transperancy			
		
		If TileFrame>-1 Then DrawImage(map.tset,x,y,TileFrame)	'draw the tileset image so long as the frame isn't -1 (empty tile)
		
	End Method	
	
End Type



EDIT: Right-click to erase btw.

This is my best achievment in Blitz so far :)

looks cool, shame I don't need one right now. nice one.

Thanks.

Looks very interesting. Not my kind of thing though.

Here is some example code which loads a .tgm file:
'example of loading a .tgm file for use in a project
'coded for use with a .tgm file created with Tile Guru 0.6b

SuperStrict

Graphics 640,480,0

Local file$="maps/BerralPyramid.tgm"	'the .tgm file you want to load

Local in:TStream=OpenStream(file$)	'read the file
							
	Local FileVersion$=ReadLine(in)	'read the version of Tile Guru that the map was made with
	Local TileSet$=ReadLine(in)		'read the tileset image that was used in the map 
	Local TileWidth:Int=ReadInt(in)	'read the width of each tile in pixels
	Local TileHeight:Int=ReadInt(in)'read the height of each tile in pixels
	Local Frames:Int=ReadInt(in)	'read the number of frames that the tileset has
	Local TilesAcross:Int=ReadInt(in)'read the number of tiles across the map
	Local TilesDown:Int=ReadInt(in)	'read the number of tiles down the map
	Local Layers:Int=ReadInt(in)	'read the number of layers the map uses
	
	Global map:tilemap=tilemap.Create(TileWidth,TileHeight,TileSet$,TilesAcross,TilesDown,Frames,Layers)	''Create' the tile map (see below)
	
	For Local l:Int=0 To Layers-1	'from 0 to the number of layers		
		For Local y:Int=0 To TilesDown-1	'from 0 to the number of tiles DOWN (y) the map		
			For Local x:Int=0 To TilesAcross-1	'from 0 to the number of tiles ACROSS (x) the map
				map.tiles[x,y,l].TileFrame=ReadInt(in)	'read each tile's frame and insert it into the array (see below)
			Next														
		Next	
	Next	
	
CloseStream(in) 'stop reading the file

While Not KeyHit(KEY_ESCAPE)	'main loop

	map.Draw(TilesAcross,TilesDown,TileWidth,TileHeight,Layers)	'draw all the tiles (see below)

	Flip;Cls
	
Wend

Type tilemap	'stores an array of all the tiles and stores the tileset image

	Field tset:TImage,tiles:tile[,,]	'set a blank array with 3 dimensions
	
	Method Draw(TilesAcross:Int,TilesDown:Int,TileWidth:Int,TileHeight:Int,Layers:Int)
	
		For Local l:Int=0 To Layers-1	'from 0 to the number of layers
			For Local x:Int=0 To TilesAcross-1	'from 0 to the number of tiles ACROSS (x) the map
				For Local y:Int=0 To TilesDown-1	'from 0 to the number of tiles DOWN (y) the map
					tiles[x,y,l].Draw(x*TileWidth,y*TileHeight)	'draw each tile at its respective position and layer (see below)
				Next
			Next		
		Next				
	
	End Method
	
	Function Create:tilemap(TileWidth:Int,TileHeight:Int,TileSet$,TilesAcross:Int,TilesDown:Int,Frames:Int,Layers:Int)
		
		Local tm:tilemap=New tilemap 'create a new tilemap object
			tm.tset=LoadAnimImage(TileSet$,TileWidth,TileHeight,0,Frames)	'load the tileset image
			tm.tiles=New tile[TilesAcross,TilesDown,Layers]	'create the array of the tile type (see below)
											
		For Local l:Int=0 To Layers-1	'from 0 to the number of layers
			For Local x:Int=0 To TilesAcross-1	'from 0 to the number of tiles ACROSS (x) the map
				For Local y:Int=0 To TilesDown-1	'from 0 to the number of tiles DOWN (y) the map							
					tm.tiles[x,y,l]=New tile	'create each tile object								
				Next
			Next
		Next
		
		Return tm					
		
	End Function
	
End Type

Type tile	'stores each tile's frame and draws them
	
	Field TileFrame:Int	'the tile's frame
	
	Method Draw(x:Int,y:Int)				
		
		SetColor(255,255,255)
		SetBlend(ALPHABLEND)	'enable transperancy			
		
		If TileFrame>-1 Then DrawImage(map.tset,x,y,TileFrame)	'draw the tileset image so long as the frame isn't -1 (empty tile)
		
	End Method	
	
End Type



Its been updated (0.7b): http://www.paulleduc.com/files/TileGuru0-7b.zip
A few bugs were fixed and you can now change the window size.

I updated it to version 1.0: www.paulleduc.com/files/TileGuru1-0.zip
I fixed some big and small bugs, added an optional grid and made 2 maps and added to the samples. You can also drag .tgm files into the window to open them now.
I'm going to stop developing it now as I am happy with it.

Bad link... your file name is "TileGuru1-0.zip".

Downloading now...

Oops, edited it.

The samples doesn't load up and the Bmax code crashes...

OK, I'm releasing another version soon.

Ugh. It's going to take another few days I think. My code is very sloppy and although I am more organized now, I can't make resizing the maps work unless I create a new map and copy the tiles back onto it.