ID:2247927
 
Is it possible to change the pivot point of an icon prior to an animate() rotation? The player base for my game uses a 64x icon but the actual person is offset near the bottom of the icon. This causes him to essentially rotate by his head rather than the desired effect of rotating from the middle of his body. If the answer to my initial question is "no", a clean workaround/bandaid solution would be appreciated

Translate() the matrix however many pixels so the center is in the right position. For example if the base sprite rotates around a spot 10 pixels to the right of where you want the center to be, Translate() 10 pixels to the left and everything should work how you want.
In response to MisterPerson
MisterPerson wrote:
Translate() the matrix however many pixels so the center is in the right position. For example if the base sprite rotates around a spot 10 pixels to the right of where you want the center to be, Translate() 10 pixels to the left and everything should work how you want.

After reading the documentation on it, it appears you're right; thank you! One question though: while I'm sure I can create a matrix before my 3 animates and apply the Translate, is there a way for me to write it straight in with the rest of the animate arguments? (I'd rather do it that way)
animate(M, transform = turn(matrix(0.75,0.75,MATRIX_SCALE), 120), time = speed, loop = spins)
animate(transform = turn(matrix(0.5,0.5,MATRIX_SCALE), 240), time = speed)
animate(transform = turn(matrix(0.1,0.1,MATRIX_SCALE), 360), time = speed)
You can store the value of the matrix() in a variable, do your scaling and translating, then set the transform variable to the result of that instead of a straight matrix() call.

var/matrix/m = matrix(0.75,0.75,MATRIX_SCALE)
m.Translate(x,y)
animate(src,transform=m,...)


As an example.
In response to Nadrew
Nadrew wrote:
You can store the value of the matrix() in a variable, do your scaling and translating, then set the transform variable to the result of that instead of a straight matrix() call.

> var/matrix/m = matrix(0.75,0.75,MATRIX_SCALE)
> m.Translate(x,y)
> animate(src,transform=m,...)
>

As an example.

I guess I'll go that route instead of attempting to be lazy lol. It'll give me more control over it anyway