0
下面的代碼生成精靈並分配定位點和旋轉。精靈會旋轉很多,有沒有辦法獲得精靈右下角的位置。就像,精靈的定位點是(0,1),我可以得到定位點(1,1)的位置嗎?這樣,即使它正在旋轉,我總能得到精靈的相同位置?獲取精靈部分的位置
tempsprite = [CCSprite spriteWithSpriteFrameName:@"image.png"];
tempsprite.rotation += 90;
tempsprite.anchorPoint = ccp(0,1);
tempsprite.position = tempsprite;
[self addChild:tempsprite];
這有點哈克,但它的工作原理。 – user2121776