replit / kaboom

💥 JavaScript game library
https://kaboomjs.com
MIT License
2.67k stars 228 forks source link

the scale component within kaboom initialization is not working with a custom canvas size #758

Open qsun81 opened 1 year ago

qsun81 commented 1 year ago

hi, The playground in kaboomjs.com might be using an older version, but it can still replicate the error. In the playground option "platformer", I have set the width and height of the canvas, and changed the scale. When the scale is less than 1, the issue is shown. The image below is when the scale is 1. (width 960, and height 640)
image

below is when scale is 0.5 image

I'm trying to make a reactive screen that can fit also into mobile devices by dynamically change the scale, but apparently, I need to find another way around if the issue persists.

Thank you! and Pls Help~!

mqce commented 1 year ago

this works for me.

js kaboom({ scale:1 });

css transform: scale(0.5);

qsun81 commented 1 year ago

this works for me.

js

kaboom({ scale:1 });

css

transform: scale(0.5);

Thank you!

I guess the scale factor works fine as long as I don't set the width and height of the canvas in the kaboom options.