0
我有一個鳥精靈,我想在屏幕上跳動。所以當它到達屏幕的邊界時,鳥會來回移動。這是行得通的,但我無法每次翻轉精靈。它第一次向右移動並且碰到屏幕的右邊緣,當它回來並碰到左側時,精靈不會翻轉。這是我想要做的在更新循環中翻轉雪碧
- (void)update:(ccTime)dt
{
if (bird_x > 1550 || bird_x < 0)
{
flip *= -1;
self.bird.flipX = YES;
}
bird_x = bird_x + 10 * flip;
_bird.position = ccp(bird_x, 1000);
}
我在做什麼錯了? 在此先感謝。
Thanks.that did the trick – Anil