Change the center of the whole game
arwinmargallo

hi, I see that the center of the game is at 0,0 so how do you change it? like 0,0 is the top left of the game. Thanks!

All 3 Comments
hermes

if you want the top-left corner of the screen to be (0, 0) in your game worlds coordinates, i think you can just move the camera by half the screen size

wade.setCameraPosition({x: wade.getScreenWidth()/2, y: wade.getScreenHeight()/2, z: 1});

it works if you dont move the camera on z (to zoom in/out). If you do i think theres more maths involved.

arwinmargallo

Thanks hermes! that's very helpful.

hermes

I forgot to add one thing: you should change the camera position every time the screen is resized to keep the top-left at (0, 0). In your App function, just add this:

this.onResize = function(){    wade.setCameraPosition({x: wade.getScreenWidth()/2, y: wade.getScreenHeight()/2, z: 1});};
Post a reply
Add Attachment
Submit Reply
Login to Reply