Jump to content

Having issues with responsive images / design


Recommended Posts

Hello, first post here.
I'm working on a game and having some issues with the responsive design.


"phaser": "^3.18.1",

The first problem.

1.) When I add a tile sprite for the background image it only covers 1/4th of the screen even though I'm passing it the correct Width and height of the canvas.
 Sure I could multiple it by 2 but I'd like to do it correctly and not run into problems down the road. Why is this happening?



create(): void {
let w = Number(this.sys.canvas.width)
let h = Number(this.sys.canvas.height)
this.bgtile = this.add.tileSprite(0, 0, w , h , 'bg')
this.station = this.add.image(1700, 400, 'station')
this.station.scale = window.devicePixelRatio

The Second problem.

2.) I can't get images / sprites to resize in proportion to the screen size.

On my largest monitor you can see the HUD glass pane menu is space somewhat decently.
However if I switch the game to my laptop it becomes smooshed a seen in the other picture.

How can I nip all these problems in the butt now and make sure all my game assets are proportional regardless of screen size.


Link to comment
Share on other sites


  • Recently Browsing   0 members

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