Implementing Coordinates

Hello I would like to know how I could be able implement coordinates into my game kinda like how you can see your coordinates or exact in Minecraft but I wanna do something like that so I can implement secret areas or help people out when looking for certain things in my game

Hello? Anyone there?

I’m not sure what you’re asking. You can use the player’s x, y or the camera x, y depending on your project. You can use trunc() to remove the decimals or roundTo(value, #of places) to round the number to a certain number of decimals.

If player x() is 105.12345
roundTo(player.X(), 3) would return 105.123

You can display it in a text object.

If that’s not what you meant then please explain further.

so what I meant was like showing a text object in the corner of the screen lets say top-right corner or top-left but anyways showing your exact location in coordinates so i can implement secret areas or help the player with what they are looking for/need to find.

but I will try that out, thank you!

thats exactly what Keith said though?

oh ok thank you for telling me

Late Message but are you able to explain this further, like will I need to make a variable or something

You can use 1 text object or multiple. I used 2 for clarity. I added a layer named UI and added the text objects to that layer. That way, the player’s layer can move but the text would remain in place.

The first 2 use trunc() to truncate the number. Meaning removes the decimal.
The 2nd uses roundTo() to round it to the # of decimal places.
The version you use depends on the needed accuracy and things like the zoom level.

ok, thank you very much!

1 Like