7.5 KiB
7.5 KiB
Phaser 3.60.0 Change Log
Return to the Change Log index.
Tilemap New Features
- The
TilemapandTilemapLayerclasses have a new methodgetTileCorners. This method will return an array of Vector2s with each entry corresponding to the corners of the requested tile, in world space. This currently works for Orthographic and Hexagonal tilemaps. - You can now control the drawing offset of tiles in a Tileset using the new optional property
Tileset.tileOffset(which is a Vector2). This property is set automatically when Tiled data is parsed and found to contain it. Fix #5633 (thanks @moJiXiang @kainage) - The
Tilemap.createFromObjectsmethod has been overhauled to support typed tiles from the Tiled Map Editor (https://doc.mapeditor.org/en/stable/manual/custom-properties/#typed-tiles). It will now also examine the Tileset to inherit properties based on the tile gid. It will also now attempt to use the same texture and frame as Tiled when creating the object (thanks @lackhand) - Experimental feature: The
TilemapLayernow has theMaskcomponent - meaning you can apply a mask to tilemaps (thanks @samme) TilemapLayer.setTintis a new method that allows you to set the tint color of all tiles in the given area, optionally based on the filtering search options. This is a WebGL only feature.- The Hexagonal Tilemap system now supports all 4 different types of layout as offered by Tiled:
staggeraxis-y + staggerindex-odd,staggeraxis-x + staggerindex-odd,staggeraxis-y + staggerindex-evenandstaggeraxis-x, staggerindex-even(thanks @rexrainbow)
Tilemap Updates
Tilemap.getLayerIndexwill now returnnullif a given TilemapLayer instance doesn't belong to the Tilemap or has been destroyed.Tilemap.addTilesetImagehas a new optional parametertileOffsetwhich, if given, controls the rendering offset of the tiles. This was always available on the Tileset itself, but not from this function (thanks @imothee)- The
MatterTileBodyclass, which is created when you convert a Tilemap into a Matter Physics world, will now check to see if the Tile hasflipXorflipYset on it and rotate the body accordingly. Fix #5893 (thanks @Olliebrown @phaserhelp) - Removed the
HexagonalTileToWorldYfunction as it cannot work without an X coordinate. UseHexagonalTileToWorldXYinstead. - Removed the
HexagonalWorldToTileYfunction as it cannot work without an X coordinate. UseHexagonalWorldToTileXYinstead. TileMap.createBlankDynamicLayerhas now been removed as it was deprecated in 3.50.TileMap.createDynamicLayerhas now been removed as it was deprecated in 3.50.TileMap.createStaticLayerhas now been removed as it was deprecated in 3.50.
Tilemap Bug Fixes
Matter.convertTilemapLayershad an edge-case which could create composite bodies unintentionally. If any tiles had multiple colliders and you were providing body creation options, thepartsproperty in the options would be modified and then concatenated with any bodies created after it. This could mean that some tiles would be combined when they shouldn't be, and on large maps would eventually hang once the convex hull got too big / complex. It now runs a copy on the object before using it (thanks @EddieCameron)- The
TilemapLayer.skipCullfeature wasn't being applied correctly for Isometric, Hexagonal or Staggered tiles, only for Orthographic tiles (the default). It will now respect theskipCullproperty and return all tiles during culling if enabled. Fix #5524 (thanks @veleek) - Recoded the point conversion math in the
HexagonalTileToWorldXYfunction as it was incorrect. Now returns world coordinates correctly. Tilemap.copywould error if you copied a block of tiles over itself, even partially, as it tried to copy already replaced tiles as part of the function. It will now copy correctly, regardless of source or destination areas. Fix #6188 (thanks @Arkyris)Tile.copywill now use theDeepCopyfunction to copy theTile.propertiesobject, as otherwise it just gets copied by reference.- Recoded the point conversion math in the
HexagonalWorldToTileXYfunction as it was incorrect. Now detects any dimension hexagon correctly. Fix #5608 (thanks @stonerich) - Fixed the point conversion math in the
IsometricWorldToTileXYfunction and added optional boolean property that allows the setting of the tile origin to the top or base. Fix #5781 (thanks @benjamin-wilson) - Calling
Tilemap.worldToTileXorworldToTileYon a Isometric or Hexagonal Tilemap will now always returnnullinstead of doing nothing, as you cannot convert to a tile index using just one coordinate for these map types, you should useworldToTileXYinstead. - The
Tilemap.destroyLayermethod would throw an error "TypeError: layer.destroy is not a function". It now correctly destroys the TilemapLayer. Fix #6268 (thanks @samme) MapDataandObjectLayerwill now enforce that theTilemap.objectsproperty is always an array. Sometimes Tiled willl set it to be a blank object in the JSON data. This fix makes sure it is always an array. Fix #6139 (thanks @robbeman)- The
ParseJSONTiledfunction will now run aDeepCopyon the source Tiled JSON, which prevents object mutation, fixing an issue where Tiled Object Layer names would be duplicated if used across multiple Tilemap instances. Fix #6212 (thanks @temajm @wahur666) - The
Tilemap.createFromObjectsmethod will now correctly place both tiles and other objects. Previously, it made the assumption that the origin was 0x1 for all objects, but Tiled only uses this for tiles and uses 0x0 for its other objects. It now handles both. Fix #5789 (thanks @samme) - The
Tilemap.tileToWorldYmethod incorrectly had the parametertileX. It will worked, but didn't make sense. It is nowtileY(thanks @mayacoda) - The
Tilemap.convertTilemapLayermethod would fail for isometric tilemaps by not setting the physic body alignment properly. It will now callgetBoundscorrectly, allowing for use on non-orthagonal maps. Fix #5764 (thanks @mayacoda) - The
ParseTileLayersfunction has been updated so that it no longer breaks when using a Tiled infinite map with empty chunks (thanks @jonnytest1) - The
PutTileAtfunction will now set the Tile dimensions from the source Tileset, fixing size related issues when placing tiles manually. Fix #5644 (thanks @moJiXiang @stuffisthings) - The new
Tileset.tileOffsetproperty fixes an issue with drawing isometric tiles when an offset had been defined in the map data (thanks @moJiXiang) - The
Tilemaps.Tile.getBoundsmethod would take acameraparameter but then not pass it to the methods called internally, thus ignoring it. It now factors the camera into the returned Rectangle. Tilemap.createFromObjectshas had the rendering of Tiled object layers on isometric maps fixed. Objects contained in object layers generated by Tiled use orthogonal positioning even when the map is isometric and this update accounts for that (thanks @lfarroco)- The
TilemapLayer.getTilesWithinShapemethod would not return valid results when used with a Line geometry object. Fix #5640 (thanks @hrecker @samme) - When creating a
MatterTileBodyfrom an isometric tile the tiles top value would be incorrect. ThegetTopmethod has been fixed to address this (thanks @adamazmil)
Return to the Change Log index.
📖 Read the Phaser 3 API Docs 💻 Browse 2000+ Code Examples 🤝 Join the awesome Phaser Discord