The description of the method stated that you could pass a string to look up an object layer based on its name, but the original code only looked for a gui property, regardless of type.
I'm using Tiled 0.11.0 on OSX, and my exported json-file doesn't contain a gui property on the object layers. Here's a snippet of my file:
```
{
"layers":[
{
"draworder":"topdown",
"height":0,
"name":"Objects",
"objects":[
{
"height":48,
"id":1,
"name":"pier",
"properties":
{
},
"rotation":0,
"type":"",
"visible":true,
"width":64,
"x":208,
"y":240
}],
"opacity":1,
"properties":
{
"type":"pier"
},
"type":"objectgroup",
"visible":true,
"width":0,
"x":0,
"y":0
}]
}]
}
```
The property in my file is called id and not uid. This might be due to changes in one of the later releases of Tiled. I kept the check for uid to avoid possibly breaking compatibility with older versions of Tiled.
I also added scaling of the sprite.
Feel free to make formatting changes, or rewrite the function to better fit the programming style of Phaser.
Since Tilemap.getTile lets you specify wether to return null
or an empty tile when index is -1, the WorldXY equivalent
should offer the same possibility for a more unified interface.
As implementation is leaning on 0.11.0 feature of Tiled, I made sure the earlier Tiled files that might be used are not going to break from this. Defaulting to empty string if the .type property is not defined by Tiled (for Tiled < 0.11.0), otherwise we use the provided value.
Why isn't the .type already read from the objects details as it's there? Latest release version of Tiled 0.11.0 has this field for Objects and it's quite extensively used by other frameworks.
Well, I need this and I suppose there are other people too who might be interested in having this in here too. Currently I go around this by creating a custom property of "type" and setting my value on it but that's just extremely silly.
- Memory optimization of delta-scroll shifting.
- The copy canvas is shared between all TilemapLayers
- The copy is done in segments to reduce the memory usage of the copy
canvas. Currently this is a 1/4 ratio.
- Device has the feature (by browser) check to see if bitblt works
- TilemapLayer will automatically enable the double-copy as needed
- Device.whenReady can be used to override the device value
- This change uses a secondary canvas and rectangle clearing instead of a
'copy' composition on the same canvas. This should hopefully address
the flickering issue in Safari and Safari Mobile
Addresses https://github.com/photonstorm/phaser/issues/1371 - where Tiled
used floor calculations and Phaser used round calculations.
There are no breaking changes with the demos; however, if there was code
that relied on behavior that _deviated_ from the defactor Tilemap behavior
then may be prone to "incorrect results" if using tileset images that are
not correctly aligned to tilesize multiples.
This also adds/corrects some warnings:
- A warning when the tileset size is not an even multiple (it was
suppressed due to using `round` prior to the checks.
- A warning if loading an image changes the cols/rows of a Tileset
- A specific warning for Tileset Image Collections which are not yet
supported