Discuss Scratch

Zero0111
Scratcher
100+ posts

Opposite of Absolute Value

Since the math block if you choose ABS (Absolute Value) it makes any negative number to a positive number but is there a block that makes it so any positive number changes into a negative number? For example if the number was 3 it would turn into -3 is there a way to do that?

check out my latest project! Sword Hero
check out my profile My Profile
forever
be happy
end
TONYflashB
Scratcher
100+ posts

Opposite of Absolute Value

Just do
((0) - ([abs] of (number)))

The 0- changes negative to positive and positive to negative.
Hope that helps

Hey there I am TONYflash! General forum helper, coder, artist.
Ask me for help on my profile or projects.
Currently giving suggestions and ideas to help others. Helping keep forums alive

Try Virtual-Box, it is a 2D Platformer Creator

banner by the wow shop!

helloworldbyeworld
Scratcher
1000+ posts

Opposite of Absolute Value

You can also flip the sign by multiplying by -1 (it’s more understandable than 0-number for me):

(([abs v] of (your number::grey)::operators) * (-1))

That way, if the number is positive, it will flip the sign, but if not, it will leave it as it is.

Helloworldbyeworld | 1200+ posts
Have a great day

Powered by DjangoBB