YellowAfterlife

translation of http://forum.hellroom.ru/index.php?topic=1078

May 10th, 2012
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.35 KB | None | 0 0
  1. [image 1]
  2. While developing our game [Journey to Hammerdale] we have faced a problem of built-in GameMaker level edtior to be very limited in it's abilities, thus began to search for alternatives. We needed a very simple and handy map editor that would support multiple layers (and manipulations over them). A matching one was found quite fast - [Tiled Map Editor]. It's capabilities were fully covering our needs and so a loader for ones map format was done in [Game Maker].
  3. [image 2]
  4. Apart from actual tiles, Tiled allows to place object, and assign properties to objects and layers around the map. Support for this functionality was also added to loader. For example, in map properties level name and background color were defined. In object properties - instance-specific variables like saw's movement speed. Support for horizontal and vertical mirroring of tiles was also added in, along with layer transparency.
  5. [Usage]
  6. Process is simple, though still requires a couple of actions.
  7.  
  8. First you need to draw your map in [Tiled]. Map can be of any size, and contain any number of objects and/or layers. Also you can add custom properties to map, layers, and objects (property handling is described below).
  9.  
  10. Then launch [Tiled2GMConverter], and select your map in it. File will be processed and saved as a [.lvl].
  11.  
  12. The last thing to do is to open [TiledLoader] in [GameMaker] and configure it - add your objects, and if needed, property handlers.
  13.  
  14. ---
  15.  
  16. Map loading is done from [Create] event of object [o_controller].
  17. [code]load_room('loader_demo.lvl')[/code]
  18. here you specify filename, in which map is saved.
  19.  
  20. In script [define_objects] you need to setup your objects (with same order as in objects-tileset). Un-recognized objects will be displayed as special object type [o_not_defined], which looks like a black circle with red-cross in the middle.
  21.  
  22. Script [check_property] does handling of map and layer properties. As an example, map property [bgcolor] is handled, which defines background color, and [name], which defines window title. For layers, [depth] property is handled, which defines depth (draw order) for layer. If depth of layer is not defined, it is set to 10000.
  23.  
  24. View properties can be configured in the end of [load_room] script, via command [room_set_view].
  25.  
  26. Property handling of object properties is done in [Create] event of objects. As an example, a single property is handled for [o_skeleton] and several properties are handled for [o_doctor].
  27.  
  28. Important: Tileset images must be placed in [tilesets] folder, while loaded maps must be placed in [maps] folder.
  29.  
  30. Cursor control keys can be used for scrolling map in the example.
  31.  
  32. [Limitations]
  33. At the moment there are several limitations for files, that are processed by converter:
  34. * Data encoding must be set to base64 (can be set in [Tiled] properties)
  35. [image 3]
  36. * Objects must be drawn via 'object tile' instrument - other types of objects are not supported.
  37. [image 4]
  38. * Tile rotation (+- 90 degrees) is not supported.
  39. * Names of tileset files must be defined inside of map, rather than separate file (this may occur if external tile set is defined in editor)
  40. Example:
  41. [code]<tileset firstgid="1" source="objects.tsx" />
  42. <tileset firstgid="626" name="tileset99999" tilewidth="32" tileheight="32">
  43. <image source="tileset99999.png" width="800" height="800" />
  44. </tileset>[/code]
  45. here the line
  46. [code]<tileset firstgid="1" source="objects.tsx" />[/code]
  47. points to external file, in which tileset properties are defined:
  48. [code]<tileset name="objects" tilewidth="32" tileheight="32">
  49. <image source="objects.png" width="800" height="800" />
  50. </tileset>[/code]
  51. At the moment converter cannot handle such external files, so data from external file must be added in like this:
  52. [code]<tileset firstgid="626" name="tileset99999" tilewidth="32" tileheight="32">
  53. <image source="tileset99999.png" width="800" height="800" />
  54. </tileset>[/code]
  55. For this example, resulting code will be:
  56. [code]<tileset firstgid="1" name="objects" tilewidth="32" tileheight="32">
  57. <image source="objects.png" width="800" height="800" />
  58. </tileset>[/code]
  59.  
  60. [Contact]
  61. If you have found an error, or have suggestions, send me a message.
  62.  
  63. [Links]
  64. [ Download Tiled2GM Converter : http://j2h.ru/wp-content/uploads/2012/05/Tiled2GM.rar ]
  65. [ Tiled Map Editor : http://www.mapeditor.org/ ]
  66. [ Devlog of our game "Journey To Hammerdale" : http://j2h.ru/ ]
Add Comment
Please, Sign In to add comment