phaser-ce icon indicating copy to clipboard operation
phaser-ce copied to clipboard

TilemapLayer crops its rendered image if width/height are less than game's width/height

Open DrDerico opened this issue 7 years ago • 3 comments

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!

DrDerico avatar Jun 23 '17 08:06 DrDerico

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.

samme avatar Jun 29 '17 16:06 samme

See also #34 . I wish we had an example (@hexus?).

Added tileOffset (Phaser.Point) property to Phaser.TilemapLayer. This allows offsetting layer positions in a way that plays well with the camera and Arcade physics. Also, the offsetx and offsety properties are now read from the layer properties of Tiled maps.

samme avatar Aug 03 '17 20:08 samme

Good idea, I could put one together at some point.

hexus avatar Aug 04 '17 11:08 hexus