Floor and ceil function

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By hotmailking

As far as I’m concerned GDScript doesn’t contain floor() and/or ceil() functions, which currently I am in desperate need of for a mechanic. What’s the best way to go about implementing these?

:bust_in_silhouette: Reply From: mrLogan

floor function

ceil function

:bust_in_silhouette: Reply From: woopdeedoo

Just to add to mrLogan’s answer, as a general rule you can use the Search Help feature on the top-right of the script editor as a quick and easy way to check if a function exists in GDScript.

Just type the name of the function there and it gives you back all the places where it exists (if it does). In this case it’s from the GDScript base class, although other objects also have their own floor() and ceil(), like Vectors, for example.