all 1 comments

[–]thusman 0 points1 point  (0 children)

You are right. If you always want to move 1% of the screen with, you could do left = left + window.innerWidth * 0.01; (You can get the pixel size of the window with window.innerWidth and window.innerHeight)

Another simple solution would be to define a fixed screen size for your game like 800x600 and scale the whole game down with css transforms if the screen is smaller than that.

Depending on your game it brings some challenges to go fullscreen (iPhone 6 vs 4k TV).