Any map editors for 2D games?

Community Forums/Developer Stations/Any map editors for 2D games?

D2(Posted 2007) [#1]
I'm tired of using "Data" followed by lots and lots of 000***000$$$55, you get the point. In other words, I think half the fun of game designing is visually making your maps! I'm thinking right now of the "room editor" in Game Maker, and I really like it because you can visually place, cut and move tiles.

So does anyone know of a similar editor that would work with BlitzPlus? Perhaps it converts it to .map files or whatever files are used to store map data.


ford escort(Posted 2007) [#2]
why don't you make one for you're use ? :)

i did one times ago but don't have it anymore, was fun to make ^^


tonyg(Posted 2007) [#3]
Mappy , TileStudio , FishEd , UME to name but a few.


D2(Posted 2007) [#4]
I just downloaded TileStudio. It saves as .TSP files. Will B+ be able to read that?


ford escort(Posted 2007) [#5]
blitz can use any fileformat if someone write a loader ...


tonyg(Posted 2007) [#6]
I just downloaded TileStudio. It saves as .TSP files. Will B+ be able to read that?


Did you scroll down and see the BlitzBasic loader?


LineOf7s(Posted 2007) [#7]
I just downloaded TileStudio. It saves as .TSP files. Will B+ be able to read that?

RTFM (so to speak).

What you need is in the Code menu in TileStudio. Select a template for the code output in Code Generation Settings (modify one to suit if you need to); select the output directory (if you like); click on Generate Code. This will (depending on the code template you've chosen) generate a .bb file that you can include in your program.


D2(Posted 2007) [#8]
Perfect. Got both Tilestudio and Mappy. Now all I need to do is figue out the placement of enemies and items througout the map. Any idea how to do that?


ford escort(Posted 2007) [#9]
do you wan't us to write you a game ? ^^


Amon(Posted 2007) [#10]
Now all I need to do is figue out the placement of enemies and items througout the map. Any idea how to do that?



Well you could find the location of each enemy in the tilmap and then have behaviours assigned to them.

Something like this. Please note that this code doesn't work as such but it does give you an idea of what to do.

SuperStrict

Const TILESIZE:Int = 32

Type Enemy
	Field x:Int
	Field y:Int
	Field id:Int
	
	Global List:TList() 
	Global TempID:Int = 0
	
	
	Function CreateGetXAndGetY() 
		If not Enemy.List
			Enemy.List = CreateList() 
		End If
	
		For Local xiter:Int = 0 Until MapWidth
			For Local yiter:Int = 0 Until MapHeight
				If MapArray[xiter, yiter]= 1  ' if 1 is where an enemy would be placed in the 
					Local e:Enemy = New Enemy ' Array ie on the screen
					e.x = Enemy.GetX(xiter) 
					e.y = Enemy.GetY(yiter) 
					e.id = Enemy.TempID
					Enemy.List.AddLast(e) 
					Enemy.TempID:+1
				EndIf
			Next
		Next
		
	End Function
	
	Method DrawEnemy() 
		For Local xiter:Int = 0 Until MapWidth
			For Local yiter:Int = 0 Until MapHeight
				If MapArray[xiter, yiter]= 1
					DrawImage EnemyImage, x, y, 0
				End If
			Next
		Next
	End Method
	
	
	Function MoveEnemy() 
		For Local e:Enemy = EachIn Enemy.List
			If Enemy.id = Rand(Enemy.id)  ' pick a random enemy in the list
				If KeyDown(Blah) 
					DoSTuff() 'Move him of assign behaviours		
				End If
			EndIf
	End Method
	
	Function GetX:Int(XPosition:Int) 
		Return XPosition * TILESIZE
	End Method
	
	Function GetY:Int(YPosition:Int) 
		Return YPosition * TILESIZE
	End Function
End Type



D2(Posted 2007) [#11]
No, I do not want you to make the game for me. I'm just new at this, and if you meant that insultingly then please keep it to yourself.

Sorry, I've had very bad experiences in forums in the past.

So I can't use a map utility to graphically place items, enemies, etc in the game?


Amon(Posted 2007) [#12]
Here's a better working example. :)

It uses defdata to store map data. It would be the same if you created the map with a map editor.

Think of the defdata as what is stored in the map when you output from TileStudio etc.

Run whats below in max and it should work out the box. :)

SuperStrict

Const TILESIZE:Int = 50

Const MAPWIDTH:Int = 16
Const MAPHEIGHT:Int = 12

Global MapArray:Int[MAPWIDTH, MAPHEIGHT]

Graphics 800, 600

Type TEnemy
	Field x:Int
	Field y:Int
	Field EID:Int
	Field Direction:Int
	
	Global List:TList
	Global TempID:Int = 0
	Global EnemyCreated:Int = 0
	
	Function Create() 
		If not TEnemy.List
			TEnemy.List = CreateList() 
		End If
		For Local xiter:Int = 0 Until MAPWIDTH
			For Local yiter:Int = 0 Until MAPHEIGHT
				If MapArray[xiter, yiter]= 3
					Local e:TEnemy = New TEnemy
					e.x = TEnemy.GetX(xiter) 
					e.y = TEnemy.GetY(yiter) 
					e.EID = TEnemy.TempID
					e.Direction = Rand(1) 
					TEnemy.List.AddLast(e) 
					TEnemy.TempID:+1
					TEnemy.EnemyCreated = 1
				End If
			Next
		Next
	End Function
	
	Method DrawEnemy() 
		SetColor 255, 0, 0
		DrawRect x, y, TILESIZE, TILESIZE
		SetColor 255, 255, 255
	End Method
	
	Method MoveEnemy() 
		If Direction = 1
			x:+2
		ElseIf Direction = 0
			x:-2
		End If
		
		If MapArray[x / TILESIZE, y / TILESIZE + 1]= 0 or MapArray[x / TILESIZE + 1, y / TILESIZE + 1]= 0
			If Direction = 0
				Direction = 1
			ElseIf Direction = 1
				Direction = 0
			EndIf
		End If
		
		If MapArray[x / TILESIZE, y / TILESIZE]= 1 or MapArray[x / TILESIZE + 1, y / TILESIZE]= 1
			If Direction = 0
				Direction = 1
			ElseIf Direction = 1
				Direction = 0
			EndIf
		EndIf
		
	End Method
	
	Function GetX:Int(XPosition:Int) 
		Return XPosition * TILESIZE
	End Function
	
	Function GetY:Int(YPosition:Int) 
		Return YPosition * TILESIZE
	End Function
	
End Type


For Local yiter:Int = 0 Until MAPHEIGHT
	For Local xiter:Int = 0 Until MAPWIDTH
		Local MapData:Int
		ReadData MapData
		MapArray[xiter, yiter]= MapData
	Next
Next

TEnemy.Create

While not KeyHit(KEY_ESCAPE) 
	Cls
		DrawMap() 
		
		If TEnemy.EnemyCreated = 1
			For Local e:TEnemy = EachIn TEnemy.List
				e.DrawEnemy
				e.MoveEnemy
			Next
		End If
		
	Flip
WEnd


Function DrawMap() 
	For Local xiter:Int = 0 Until MAPWIDTH
		For Local yiter:Int = 0 Until MAPHEIGHT
			If MapArray[xiter, yiter]= 1
				DrawRect xiter * TILESIZE, yiter * TILESIZE, TILESIZE, TILESIZE
			End If
		Next
	Next

End Function

' 1 = wall
' 3 = Enemy

DefData 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 0, 3, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 1
DefData 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 3, 0, 1
DefData 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1
DefData 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
DefData 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1



Amon(Posted 2007) [#13]
So I can't use a map utility to graphically place items, enemies, etc in the game?


Yes you can. You just have to give them a unique ID. Use the method I posted above to place them.

If it's just static Items then you don't need to make a move method for them. You do need to know where they are on screen though and the same way you use GetX and GetY in the code I posted above you could use it for items and the player character.