mob/verb/My_Animate(facing)
var/matrix
a = matrix()
b = matrix()
c = matrix()
b.Turn(20)
c.Turn(-40)
if(facing)
a.Scale(-1,1)
b.Scale(-1,1)
c.Scale(-1,1)
transform=a
animate(src,transform=b,time=2,easing=SINE_EASING)
animate(transform=c,time=8,easing=SINE_EASING)
Problem description:
In theory, the above code should simply tilt the mob forward a little, and then back a fair bit. If facing is active, the mob should theoretically do the same thing flipped on the x-axis.
It works fine when facing is untrue and the Scale(-1,1) isn't applied to anything, or if no rotation is applied.
When 'facing' is true however and scaling is applied, the animation overshoots the rotation by at least double, and also changes scale over the course of the animation.
My question is 'why' does it overshoot and change scale when flipped by using Scale(-1,1) when I apply rotation to it? I get the impression I really don't understand matrices as much as I should.
(I can of course simply just use a flipped icon, but it would handy for my particular situation if this worked as I expected.)
When facing left, 'facing' is true.