Jump to content

Positioning GameObjects on an auto scale game


greendot
 Share

Recommended Posts

Hi everyone,

I'm working on my first Phaser 3 game and have a question regarding the game resolution. Currently I have the game set to a fixed width and height and the coordinates of the GameObjects are hardcoded. If I want the game to autoscale, what's the best approach on how to place GameObjects in a scene?

Link to comment
Share on other sites

https://github.com/phaser-discord/community/blob/master/FAQ.md#is-there-a-scalemanager-in-v3

Basically it depends on how far you want to go and it's also game specific.
Personally I fill the whole screen and depending on what the game is either display more of the world or just scale it, or shift things around. UI is always positioned relatively so it scales, game objects might or might not be (usually not, but again, depends on the game).

Link to comment
Share on other sites

One thing that helps me a lot, especially in scenes like menu, splash, etc., is to place world coordinates 0,0 into center of screen. Then many things can be placed relative to it and on resize you do not have to reposition it. Of course, it does not work with things that should be stuck to screen borders.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...