GithubHelp home page GithubHelp logo

Comments (4)

colinvella avatar colinvella commented on August 24, 2024 1

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

from phaser-tilemap-plus.

colinvella avatar colinvella commented on August 24, 2024

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().

from phaser-tilemap-plus.

xtt13 avatar xtt13 commented on August 24, 2024

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!

from phaser-tilemap-plus.

xtt13 avatar xtt13 commented on August 24, 2024

Thank you so much! It works! Your Demo really helped me a lot. I had a misunderstanding of how scaling a game works.

from phaser-tilemap-plus.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.