Hi,
I’m rotating my entity’s spritemap and i would like to rotate the mask as well, i’ve checked the solution that was published before but i can’t get it to work, this is my class :
override public function added():void
{
super.added();
_maskSource = new BitmapData(SPRITE_WIDTH, SPRITE_HEIGHT, true, 0);
_missileIdleSprite.play(PLAY_MISSILE_IDLE);
_missileExplosionSprite.alpha = 0;
graphic = new Graphiclist(_missileIdleSprite, _missileExplosionSprite);
mask = new Pixelmask(_maskSource, -SPRITE_WIDTH / 2, -SPRITE_HEIGHT / 2);
setRotation(120);
}
private function setRotation(angle:Number):void
{
matrix = new Matrix();
matrix.rotate(angle);
rotatedMask = new BitmapData(SPRITE_WIDTH, SPRITE_HEIGHT, true, 0xFFFFFFFF);
rotatedMask.draw(_maskSource, matrix);
(mask as Pixelmask).data = rotatedMask;
}
override public function render():void
{
super.render();
_maskSource.fillRect(_maskSource.rect, 0);
_missileIdleSprite.render(_maskSource, new Point(SPRITE_WIDTH/2, SPRITE_HEIGHT/2), new Point);
}
It’s like the matrix rotation not working :p.