Hello, I trying to add a background to my game, I am trying to use config.height / 2, I have seen this in a tutorial so I know it must work. But when I try and do this.add.image(config.height/2 , config.width/2, ‘bkg’); The game screen is only black. I tried without the /2 and some of the image shows and some black shows, so I know it is somewhat working. For this to work do i need an image that is same size as canvas? Should it not center it anyway even if image larger than canvas? I have uploaded picture of what happens when i try and use this. Also, when i use just numbers ie 400, 300 (half of canvas size) the image shows correctly.

Open the browser dev console so you can see any errors.

I do

this.add.image(0.5 * this.scale.width, 0.5 * this.scale.height, 'bkg')
1 Like

Thank you so very much!!! You saved me with this fix.