phaser-ce
phaser-ce copied to clipboard
TilemapLayer crops its rendered image if width/height are less than game's width/height
Hi!
Sorry for my English.
This Issue is about rendering TilemapLayer if its cameraOffset.x/y not zero, or if TilemapLayer has width and height less than game's width/height. TilemapLayer crops its rendered image.
- A bug in the API:
- Phaser version(s): 2.6.2, 2.8.1
- Live example: https://codepen.io/DrDerico/pen/yXoaKy You'll see two white rectangles (they are TilemapLayers). First layer (rectangle) has cameraOffset (0,0), the second one has cameraOffset (200, 200). Press cursor LEFT/RIGHT/UP/DOWN. The second rectangle disappears behind its left top corner. Also the second layer manually resized to 160x160 pixels. And when moving the camera the second layer disappears behind its bounds (160x160)
I can't make my game with infinite scrolling, because TilemapLayers, that I use, disappear when the camera moves.
Thank you!
https://codepen.io/samme/pen/PjEEjW
There is an example like this (http://phaser.io/examples/v2/tilemaps/dual-view/version=2.7.0.beta2) that positions the layer with x
or y
but it works only in 2.7.0b2 and no versions before or after that.
See also #34 . I wish we had an example (@hexus?).
Added
tileOffset
(Phaser.Point
) property toPhaser.TilemapLayer
. This allows offsetting layer positions in a way that plays well with the camera and Arcade physics. Also, theoffsetx
andoffsety
properties are now read from the layer properties of Tiled maps.
Good idea, I could put one together at some point.