New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New extension: Round to any number #1271
base: main
Are you sure you want to change the base?
Conversation
Thank you for submitting an extension. What do you think about adding this expression to the rectangular grid extension? The parameters could be: "Cell size" and "Grid offset" and the expression could be used in the snap action to avoid the formula duplication. |
I could add it but I have a feeling that limiting this to just that extension would feel like a bit of a waste since it is a very general tool. |
Do you fear that people won't find it? |
Don't get me wrong, I like the idea of integrating this into other extensions but using it for only one purpose while it's a very general tool feels limiting. |
I didn't mean to hide the expression, users can still use it. |
Another idea is to add the expression to this extension: https://wiki.gdevelop.io/gdevelop5/extensions/extended-math/ |
This is not a common math function. I doubt people will try to search this feature in a Math extension. |
Only one purpose meaning it can only be used for that extension (snap to grid) and thus limiting it to only one use - snapping |
No matter the extension name, users can use the expression all the same. I don't understand your point. |
Oh |
The question is: where someones searching for this is the most likely to search in the first place? |
When i was trying to find if there was any extension for this before making it, i searched for "round" "round to any" "custom rounding" and similar. |
Considering that there are |
Description
This extension adds the ability to round to any number. Useful for things like a grid system.
How to use the extension
The extension is used through a function
RoundToAnyNumber::RoundTo()
where the first number is the number to be rounded and the second number is the number to round to.It works based on this formula:
round(Number1 / Number2) * Number2
Examples:
Rounding 12345 to 100 will give 12300.
Rounding 720 to 300 will give 600.
Rounding 7382.8129 to 0.29 will give 7 382.82 (which is a multiple of 0.29).
Checklist
What tier of review do you aim for your extension?
Community (Unreviewed)
Example file
Round to any number example.zip
Extension file
RoundToAnyNumber.zip