tihoho Posted November 6, 2018 Share Posted November 6, 2018 Hey guys! I want align tilemap to bottom screen. But it not work: // in create method ... map = this.make.tilemap({ key: "map" }); map.alignTo(this.cameras.main, Phaser.BOTTOM_CENTER, 0, 0); ... console said: Uncaught TypeError: map.alignTo is not a function How I can do it? Link to comment Share on other sites More sharing options...
elleniaw Posted November 7, 2018 Share Posted November 7, 2018 The map is not the graphical object. The layer is. (the result of createDynamicLayer or createStaticLayer) I'm not a hundred per cent sure the static or dynamic layer does have a alignTo method. If not you could try: https://photonstorm.github.io/phaser3-docs/Phaser.Display.Align.To.html Where you would call it as a static method: Phaser.Display.Align.To.BottomRight(tileLayer, this.cameras.main, etc I hope this helps. I haven't tried it out myself - but I do know that the tilemap is not a graphical object. tihoho 1 Link to comment Share on other sites More sharing options...
tihoho Posted November 7, 2018 Author Share Posted November 7, 2018 Elleniaw, Thanks for the examples. I realized that I initially chose the alignment policy incorrectly. Now I align the elements relative to the center of the camera, it turned out to be easier As I understood that the most difficult thing in game development is correct alignment and scaling of elements so that they look normal on all devices. Link to comment Share on other sites More sharing options...
Recommended Posts