Okay, so I have an entity I want to use a pixelmask with. Now, I also want to rotate the entity. I know flashpunk can’t handle rotating hitboxes, but that’s okay, since I basically have a ball which is rolling. I needed to use centerorigin to set the rotation point at the middle of the ball, but now the hitbox is way off. I tried originX and originY, but it doesn’t work.
Rotating an entity... problems
Copying
(Martí Angelats i Ribera)
#2
Have a look here. I’m not sure if the last code works 'couse noone said so but the tread is about this.
John_Andersson1
(John Andersson)
#3
Isn’t that about hitboxes? How do I make the ball rotate continuously?
Copying
(Martí Angelats i Ribera)
#4
So you only want to rotate the graphic? If that’s so, what graphic are you using? (i mean the class, like Image, Stamp, etc.)
Copying
(Martí Angelats i Ribera)
#6
I would do this:
In the contructor
private var sprite:Spritemap;
private var target:BitmapData;
private var renderer:Image;
//set spritemap
target = new BitmapData(size, size, true, 0);
renderer = new Image(target);
renderer.centerOrigin();
graphic = renderer;
and then in the render function:
override public function render():void
{
target.fillRect(target.rect, 0);
sprite.render(target, FP.zero, FP.zero);
super.render();
}
All the modifications you do to renderer
should modify the result as you spect.