Change the scale of a sprite


I have a question about the scale of sprites. We were playing around with making the sprites grow and shrink. I noticed that when you are decreasing the value of the scale property, once the value becomes a negative number, the sprite begins to get bigger.

So instead of adding and subtracting from the scale, I told my students to multiply and divide.
For example:
To grow the sprite - sprite.scale = sprite.scale * 1.05;
To shrink the sprite - sprite.scale = sprite.scale / 1.05;

That way, the scale never becomes a negative number and continues to shrink infinitely.

My question is, why does the sprite get larger once the number is negative? Does the code actually take the absolute value of the number? Just curious.



Calling in backup - will hopefully have an answer for you soon!



I sort of assumed it took the absolute value of the number. Its fun when students subtract from the value in the draw loop and then all sudden the sprite gets bigger. Its a great opportunity to talk about math with students who don’t always enjoy math class.