Cocos2d for iPhone和iPad开发指南
1. 卡片动画与处理
在使用Cocos2d进行iPhone和iPad应用开发时,卡片的处理是一个重要部分。首先,我们可以创建新的卡片图像并将其放置在屏幕外顶部居中位置,然后将其添加到Z轴为0的层上,并进行动画处理使其显示在屏幕上。
newCardImage = [CCSprite spriteWithFile:[NSString stringWithFormat:@"%@.png",
[myHand getCard:a]]];
// Place card off screen centered on the top.
newCardImage.position = ccp( size.width / 2, size.height + 50 );
// Add card image to Z-Axis:0
[self addChild:newCardImage z:0 tag:a+100];
[cardImages addObject:newCardImage];
[newCardImage release];
// Animate card to screen
[self dealCard:a];
接下来,我们可以使用 Spawn 命令让卡片在移动到指定位置的同时进行360度旋转,使动画效果更加生动。
- (void) de
超级会员免费看
订阅专栏 解锁全文
16

被折叠的 条评论
为什么被折叠?



