Diddy + Tiled - ObjectLayer and.....
Monkey Forums/Monkey Programming/Diddy + Tiled - ObjectLayer and.....| 
 | ||
| Diddy + Tiled - ObjectLayer and....... I'm a bit confused as to how this would work but I have my tiled TileMap with an Object Layer. The Object Layer has placed on to it the movable starting positions for my enemy characters. Say I have 3 enemies added to the ObjectLayer each in a different location; how would I then grab their locations and store in either a list or Array for the purpose of spawning the enemies when the tilemap is loaded and the level begins? Ta! | 
| 
 | ||
| There is the method GetAllObjects in class TileMap. 
For Local obj:TileMapObject = EachIn tilemap.GetAllObjects()
  Print("Level object found: "+obj.name+" x: "+obj.x+" y:"+obj.y)
  if obj.properties.Get("typ")<>NULL
     local typ:int=obj.properties.Get("typ")
     ' you can retreive objects parameter set by you this way
  endif 
next
 | 
| 
 | ||
| Thanks! It didn't work on a straight copy and paste but I managed to sort it by modifying it to the following: 
		For Local obj:TileMapObject = EachIn tilemap.GetAllObjects()
		  'Print("Level object found: "+obj.name+" x: "+obj.x+" y:"+obj.y)
		  If obj.Properties.Get("doo") <> Null
		     Local typ:int = obj.Properties.Get("doo").GetInt()
		     ' you can retreive objects parameter set by you this way
		  endif 
		Next
 | 
| 
 | ||
| I don't understand what is causing this error for me all of a sudden. Monkey Runtime Error : TypeError: Cannot call method 'p_ObjectEnumerator' of null | 
| 
 | ||
| Strange!!! Sometimes it works and other times it spits this error. Can anyone offer any suggestions? [edit] Nearly 3am in the morning here in London, England; my tiredness caused me to make a typo with a variable name which I have now fixed and am no longer getting this error. |