Jump to content

Having issues with responsive images / design


Heyrio
 Share

Recommended Posts

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

Using 

"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?

359369924_ScreenShot2021-10-11at10_35_09AM.thumb.png.a310777eace949717ef8dfdc8b508aa9.png

979887176_ScreenShot2021-10-11at10_36_18AM.png.0e9e57d38f068a955f4ff2bb1e8e1c96.png

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.
131223243_ScreenShot2021-10-11at10_40_39AM.thumb.png.d6f10305d161b06668b6fef5b8adf5f2.png
431053268_ScreenShot2021-10-11at10_45_01AM.thumb.png.6474a951c3e36bbb0589b299c2b35784.png

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

 Share

  • Recently Browsing   0 members

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