问题描述
我的游戏有一个碰撞检测,当我的导弹击中敌人时,敌人就会消失.我想添加一个评分系统,每次我的导弹击中敌人时加 1 分.我将在下面发布我的游戏代码(我使用了 HelloWorldLayer.m)**
My game has a collision detection where when my missile hits the enemy the enemy disappears. I want to add a scoring system that adds 1 point every time my missile hits the enemy. I'll post my game code below (I used the HelloWorldLayer.m)**
代码如下:
链接 - http://pastebin.com/iGP83SCv
在碰撞部分,我只想让它在每次弹丸击中敌人萌芽"时加 1 分,并在标签中显示分数.示例:得分:0000
In the collision section i just want it to add 1 point every time the projectile hits the enemy "sprout" and display the score in label. Example: Score:0000
PS,请尽可能简单地解释一下.
PS, please explain it as easy as possible.
推荐答案
@synthesize int 类型的 "score" 属性和类型的 "scoreLabel" 属性CCLabelTTF.
@synthesize a "score" property of type int, and a "scoreLabel" property of type CCLabelTTF.
在 -(void)init
在第 126 行,将score"属性加 1,并将该值设置为 CCLabelTTF.
On line 126, increment your "score" property by 1, and set that value into your CCLabelTTF.
这篇关于Cocos2D 中的评分系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)