How to have a number always return positive

Hey fellas. Right now im trying to change a sprite width based on the difference between two other objects position. Its all fine and dandy while everything is in the positive, but when both obj have negative positions, obviously it no longer works. I know in C# you can use Math.abs to have a number always return positive. I was wondering if GDevelop had something similar. Searching the wiki, i haven’t found anything yet. Thanks ahead of time!

Gdevelop has math functions. You can find in Σ123 button when writing variables.

I think what your looking for is Abs(number… )

Indeed it does! I took a look through the list again and found it after you mentioned. I must have missed it the first time. Thank you!

1 Like