社交游戏开发:Game Center 入门指南
1. 社交游戏开发基础操作
在社交游戏开发中,有一些基础操作需要掌握。例如,当捕捉到一只奶牛时,会执行一系列操作来更新分数和处理游戏元素。以下是相关代码:
score++;
[scoreLabel setText:[NSString stringWithFormat: @"SCORE %05.0f", score]];
[[currentAbductee layer] removeAllAnimations];
[currentAbductee removeFromSuperview];
currentAbductee = nil;
//make a new cow
[self spawnCow];
上述代码的操作步骤如下:
1. 增加分数: score++ ,将当前分数加 1。
2. 更新分数显示: [scoreLabel setText:[NSString stringWithFormat: @"SCORE %05.0f", score]]; ,将更新后的分数显示在屏幕上。
3. 移除旧奶牛的动画: [[currentAbductee layer] removeAllAnimations]; ,清除当前被捕捉奶牛的所有动画。
4. 移除旧奶牛视图: [currentAbductee removeFromSuperview]; ,从视图中移除当前被捕捉的奶牛。
5. 重置当前奶牛对象
超级会员免费看
订阅专栏 解锁全文
69

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



