(Solved) Center objects to screen

Heyo,

So I have a camera following a player. I now want to center several texts and objects to my screen. Aligning them by using X coordinates of my player or camera doesn’t work for some reason and choosing my Point.X() - Text.Width()/2 only works for the text.
I have also tried dividing my screen width by 2, but nothing works.
Is there any way of aligning my object to the center of my screen if the camera is following an object? (Also, Android does some weird scaling and messes with my alignment)

Cheers,
Ben

If your camera is moving, you’re not wanting it to be the center of the window, then. You want it to be the center of your camera.

Two things you’ll want to do:

  1. Put your text objects on a separate layer (unless for some reason they’re going to be mobile at all). This way they won’t be impacted by the camera moving on the first layer and will stay in place.
  2. Use an event to position the text objects, but set their position to CameraWidth(, ) /2 for X, and CameraHeight(, ) /2 for Y

(The (, ) is saying use the default layer and camera 0 for that layer, but you could actually populate that info, with ("",0)

4 Likes