Closed xtt13 closed 6 years ago
Hi Michael,
I did not take into account map scaling. So you are essentially scaling one of your visible layers. Obviously the object layer (any the associated shape layer) are not aware of this. Perhaps I can modify the enablePhysics method so that into account the object layer's scale and all you would have to do is to set the same scale to both layers before calling enablePhysics().
Thanks for your fast reply! A modification would help me a lot. I'm making a pixelart game and I need to scale all the layers and assets. A small production preview of the game: https://deploy-vvjtaljwgx.now.sh/
Thank you for the effort!
I'm thinking you're probably not doing it the best way. You should develop your game as if it weren't scaled and then simply use Phaser's scale mode to scale everything up. In your code you shouldn't need to scale visual elements individually - just use a small screen viewport e.g 320 x 240 pixels and then scale up transparently to the rest of your code using game scale / full screen.
Have a look at these examples:
Game scale example: https://phaser.io/examples/v2/input/game-scale
Full screen example: https://phaser.io/examples/v2/display/fullscreen
My own demo: https://github.com/colinvella/phaser-tilemap-plus-demo/blob/master/src/states/BootState.js
Thank you so much! It works! Your Demo really helped me a lot. I had a misunderstanding of how scaling a game works.
Hello colinvella,
I'm trying to enable physics with a custom Layer scaleRate
My code:
My map.json already has a CollisionObjectLayer
Is there a way to get this work? I tried messing around with
ShapeLayer.js
but it didn't work.Thanks for you help and btw: I love your Plugin!