Is it possible to rotate overlays?
I'm trying to rotate my game character's icon, but his hair which is in his overlays isn't rotating together... :(
You shouldn't be using icon math for rotations, if you use the transform variable it'll rotate smoother and use less resources, as well as rotate all overlays that aren't applied with appearance_flags that prevent it.
var/matrix/M = matrix() You can also use animate() to animate the turn so it's not instant. |
So... Lets see if i understood it right
var/matrix/M = matrix() << Declares the matrix M.Turn(angle) << Rotate the matrix src.transform = M << Rotates the mob So, if i want to turn the mob 45º, i would do M.Turn(45)? |
In response to PatrickBR
|
|
That's right, though two things. One is that if you put your code in <dm> tags it'll get syntax highlighting. For example,
<dm> var/matrix/M = matrix() M.Turn(angle) src.transform = M </dm> will appear as var/matrix/M = matrix() Second is that in DM we use // for single-line comments. E.g., var/matrix/M = matrix() // Declares the matrix You shouldn't use << because that is an operator in DM, must like + or * are operators for arithmetic. Obviously it won't work if you try to compile it with those, but using standard comment notation in posts will also make things clearer to other users. |
But it didn't even enter in that for... :(
I also tried a for(var/I ...) but it didn't work out too, but instead i got an error