![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | HarryCourt |
![]() |
Old Version | Published before Godot 3 was released. |
I have a script where the mouse drags an item. However, I want that script to be able to round to the nearest 10.
For example;
10 by 10: Correct
260 by 570: Correct
10 by 15: Incorrect
Here is the script:
func dragItem():
isDragging = true
var mousePos = get_global_mouse_position()
mousePos = mousePos.floor()
self.set_position(mousePos)
print(mousePos)
What can I do to make sure it always rounds to the nearest tenth?