I searched online and found this script that is supposed to rotate and image but I'm not sure how to use, where to put in the degree angle that I want my sprites to rotate by.
Also, I get an error. 1084: Syntax error: expecting identifier before leftparen. 1084: Syntax error: expecting rightparen before leftbrace.
var point:Point=new Point(spr_box.x+spr_box.width/2, spr_box.y+spr_box.height/2);
rotateAroundCenter(spr_box,45);
function rotateAroundCenter (ob:*, angleDegrees) {
var m:Matrix=ob.transform.matrix;
m.tx -= point.x;
m.ty -= point.y;
m.rotate (angleDegrees*(Math.PI/180));
m.tx += point.x;
m.ty += point.y;
ob.transform.matrix=m;
}
Best Answer
fix the function to this
The
45
in your code is the degrees that you want to rotate by, just change that value.