Jump to content

How to layout a scene with graphics relative to each other


Rodrigo Silveira
 Share

Recommended Posts

I'm coming to game development from a strong web development background. Not sure this is even a problem in game dev... I'm trying to layout a scene like this screenshot, and I'm not sure how one would normally go about doing this:

 

CM4OIknUAAAfNl2.png

 

Red outlines are images, and green boxes can be done with text.

 

My questions

 

  • If I just position everything absolutely, will those offsets change when I scale up/down my game (go full-screen, etc.)?
  • If I want to move that gun icon, as in the example above, do I just hardcode the two possible positions?
  • What are some of the best practices for laying out this sort of UI in Phaser?

 

Link to comment
Share on other sites

Don't position absolutely.

 

It's easy to position relatively to screen size. Eg: set Konami logo x position to game.width / 2. If you have multiple sprites that you want to be aligned (on the same line) you can add them to a group and center the group to make things easier. It's not that hard to position sprites based on game size, anchor position and/or sprite size.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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