Hey all, I’m a little new to Defold and somewhat new to game dev.
Here’s what I’m trying to do:
I’ve got an orthographic camera following a 2D player character. I’d like to clamp the x position of the camera as the player reaches the beginning and end of the tilemap. So as a player reaches the end of the map, they’ll also move closer to the right-hand side of the camera and visa-versa.
I’ve got the camera position clamping between the start and end of the map. So I think I need to somehow get the in-game pixel width of the camera view, divide that in half and use it as an offset of the min/max clamp values.
So my question is: how can I get the number of in-game pixels currently visible through a camera along the x axis?
Thanks and I hope this makes sense.
(also note that I’m not looking for something like render.get_window_width()
.