phaserjs / phaser-ce

Phaser CE is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.
http://phaser.io
MIT License
1.34k stars 491 forks source link

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

Open DrDerico opened 7 years ago

DrDerico commented 7 years ago

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.

I can't make my game with infinite scrolling, because TilemapLayers, that I use, disappear when the camera moves.

Thank you!

samme commented 7 years ago

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 commented 7 years ago

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.

hexus commented 7 years ago

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