我生成精靈編程方式是這樣的:設置錨點中間
this.food = new Sprite();
this.food.graphics.beginFill(0xFFFFFF);
this.food.graphics.drawRect(0, 0, 10, 10);
this.food.filters = [new GlowFilter(0xFF6699, .80, 5, 5, 2, 2, false, false)];
this.food.graphics.endFill();
this.food.x = this.x;
this.food.y = this.y;
this.stage.addChild(this.food);
,後來我這樣做:
public function update():void
{
// Spin the food
this.food.rotation += 1;
}
我基本上要的食物精靈慢慢旋轉關於它的中心,而不是它的x和y值,它是精靈的左上角。
如何讓錨點成爲精靈的中心?