Advertisement
Guest User

python-tmx save example

a guest
Nov 16th, 2017
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.72 KB | None | 0 0
  1. import tmx
  2.  
  3. tilemap = tmx.TileMap()
  4. tilemap.width = 3
  5. tilemap.height = 2
  6. tilemap.tilewidth = 16
  7. tilemap.tilewidth = 16
  8. tilemap.properties = [
  9.     tmx.Property("foo", "foo_value"),
  10.     tmx.Property("bar", 666),
  11.     tmx.Property("baz", tmx.Color("#FF0000"))]
  12. tilemap.tilesets = [
  13.     tmx.Tileset(0, "the_tileset", 16, 16, source="the_tileset.tsx",
  14.                 image="the_tileset.png")]
  15. tilemap.layers = [
  16.     tmx.Layer("Layer 1", tiles=[
  17.         tmx.LayerTile(0),
  18.         tmx.LayerTile(2),
  19.         tmx.LayerTile(5),
  20.         tmx.LayerTile(0),
  21.         tmx.LayerTile(26),
  22.         tmx.LayerTile(6)]),
  23.     tmx.ObjectGroup("Group 1", objects=[
  24.         tmx.Object("", "", 16, 8, gid=12)])]
  25.  
  26. tilemap.save("tilemap.tmx")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement