system
1
system
4
|
|
|
|
Reply From: |
YeOldeDM |
int(3.765)
will return the integer 3
.
You also have floor()
(round down), ceil()
(round up) and round()
which rounds a value to the nearest integer.
system
5
|
|
|
|
Reply From: |
gcivico |
Hi 9BitStrider.
I am not an expert on GDScript but if you want to get the numbers on both sides of the point, maybe you can do this:
var playerValue = 3.765
var playerValueString = String(playerValue)
var playerValueParts = playerValueString.split(".")
print(playerValueParts[0], " - ", playerValueParts[1])
# 3 - 765
But if you only want to get the left part of the decimal the answer of YeOldeDM is the way.
using int(3.765) will go faster than parsing strings
phil1234 | 2021-05-21 18:48