4.3
I set the viewport to 1280x720, but the created game window only goes to about 500. Why is that so?
I’m trying to set a border at 1280, but I need help.
4.3
I set the viewport to 1280x720, but the created game window only goes to about 500. Why is that so?
I’m trying to set a border at 1280, but I need help.
yes, I did.
What I mean is, I did it like your picture, but I thought it would output 1280 when the character (the white object in the picture) goes to the right end of the window on the game screen, but I’m curious because it doesn’t show up. The coordinates were displayed with print(position).
That depends if you’re referencing the position in the global coordinate system (which you are probably doing) or the viewport coordinates
See here my little demo that shows the difference between the two:
text = "viewport coords: " + str(get_viewport().get_mouse_position())
The second label prints this position:
text = "global coords: " + str(get_viewport().get_camera_2d().get_local_mouse_position())
Here’s the scene structure, you can see the Controls are centered in the global coordinate system:
I think I found something similar to what I wanted, and it seems to be a function called get_screen_transform(). The intention is to prevent the character from leaving the mobile screen, but I plan to change the screen border to match whatever the mobile screen resolution is. Is it okay to use this?