0 votes

I'm making an Indie game, so I wanted to put my variable "coins" rounded because it's getting more than 5 decimals when its value is multiplied, I tried using the "floor" and "stepify" function but I don't understand how they do it. because I'm still new to Godot Engine.

I'm brazilian, so i'm using google translate to do this.

Godot version 3.0
in Engine by (22 points)

1 Answer

0 votes
Best answer

Did you try something like this:

var x: float= 1.7
var y: int=int(x);

or this for rounding up or down

var x: float= 1.4233
var y: int=round(x);
by (719 points)
selected by

Thx man, you saved my entire game

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.