iPhone cocos2d 游戏中的文字输入效果
在许多游戏中,当角色说话(对话)时,文本具有打字效果,看起来就像您正在看着角色键入文本。
对于使用 cocos2d 的 iPhone 游戏来说,实现这种外观和(简单)“动画”的好方法是什么?
如果有办法用 cocos2d 做到这一点就好了,但我并不完全反对在 cocos2d 的 EAGL (OpenGL ES) 视图之上分层 UIView 子类(UILabel?)。
In many games, when a character is speaking (dialogue), the text has a typing effect, where it looks like you are watching the character type the text.
What would be a good way to achieve this look and (simple) "animation" for an iPhone game which uses cocos2d?
It's good if there's a way to do it with cocos2d, but I'm not completely opposed to layering a UIView subclass (UILabel?) on top of cocos2d's EAGL (OpenGL ES) view.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我最终使用内置 UIKit 元素 (UILabel) 并将它们作为子视图添加到窗口中。
I ended up using built-in UIKit elements (UILabel) and adding them as subviews to the window.
内置的
UIKit
无法与cocos2d-built-in
UIKit
很好地配合,例如CCLabel、CCSprite
。the built-in
UIKit
could not works well withcocos2d-built-in
UIKit
,such asCCLabel,CCSprite
.我建议使用
CCLabelTTF
和CCAction
如下:这是未经测试的代码。此外,它还假设
typeText
函数是在CCNode
的子类中实现的,因为它调用[self runAction:]
I would suggest using a
CCLabelTTF
andCCAction
as follows:This is untested code. Also, it assumes that the
typeText
function is implemented in a subclass ofCCNode
because it calls[self runAction:]