0

时隔 18 个月后,我重新开始使用 Cocos2d。我最初的指导来源是 Steffen Itterheim 和 Andreas Low 的学习 Cocos2d 书。

我不得不说我发现该指南相当直观,但遇到了几个问题。

首先是精灵的动画。毫无疑问,我正确地使用了 HD sprite(这已通过重命名 HD sprite 并收到 HD sprite atlas 不可用的警告得到证明)。

当精灵动画时,它们会变得模糊。起初我以为这是模拟器问题,然而,在我的 iPhone 5 和我的伙伴 iPhone 4 上进行测试时,也遇到了同样的模糊现象。我用于更新图形的方法如下: -

-(void) update:(ccTime)delta
{
if (self.parent.visible)
{
    CGSize screenSize = [CCDirector sharedDirector].winSize;
    if (self.parent.position.x > - 50)//screenSize.width * 0.5f)
    {
        self.parent.position = ccpAdd(self.parent.position, ccpMult(velocity, delta));
    }
            else
            {
                self.parent.visible = NO; // We've gone off screen so set to invisible. 
            }
}
}

这是使用以下方法调用的:-

-(id) initWithRate:(int)rate
{
if ((self = [super init]))
{
    velocity = CGPointMake(rate, 0); //-100
    [self scheduleUpdate];
}

return self;
}

这在添加到精灵节点的“StandardMoveComponent”类中使用。我应该补充一点,图形都来自 2 个精灵表。它们在单独的批注中,但添加到同一个 frameCache。

如果有人对我能做些什么来防止模糊有任何建议,我将不胜感激。

4

0 回答 0