Reuse cocos2d actions(重用 cocos2d 动作)
问题描述
对于使用相同动作的多个 CCSprite 重复使用相同的动作是否可能(并且是一种好的做法)?
Is it possible (and a good practice) to reuse the same actions for multiple CCSprites that use the same action?
如果我有 10 个需要缩放的 CCSprite.我创建了一个名为 scaleAction 的缩放动作.是否可以为精灵重复使用相同的动作?
For if I have 10 CCSprites that all need to be scaled. And I create a scale action called scaleAction. Is it possible to reuse the same action for a sprites?
当我尝试这样做时,我只得到一个精灵缩放而不是全部.最好的方法是什么?
When I tried to do that I get only one sprite scaling and not all of them. What's the best way to do this?
提前致谢
推荐答案
由于问题是针对多个精灵重复使用一个动作,答案很明确:否.
Since the question asks about re-using one action for multiple sprites, the answer is a clear: no.
每个精灵都必须运行自己的动作.如果节点 A 上已经运行了某个操作,而您尝试在节点 B 上运行相同的操作,则该操作只会影响两个节点之一.
Each sprite must run its own actions. If there's an action that's already running on node A and you're trying to run the same action on node B, the action will only affect one of the two nodes.
这篇关于重用 cocos2d 动作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:重用 cocos2d 动作


- 想使用ViewPager,无法识别android.support.*? 2022-01-01
- Android viewpager检测滑动超出范围 2022-01-01
- 用 Swift 实现 UITextFieldDelegate 2022-01-01
- Android - 我如何找出用户有多少未读电子邮件? 2022-01-01
- android 4中的android RadioButton问题 2022-01-01
- 使用自定义动画时在 iOS9 上忽略 edgesForExtendedLayout 2022-01-01
- 如何检查发送到 Android 应用程序的 Firebase 消息的传递状态? 2022-01-01
- Android - 拆分 Drawable 2022-01-01
- 在测试浓缩咖啡时,Android设备不会在屏幕上启动活动 2022-01-01
- MalformedJsonException:在第1行第1列路径中使用JsonReader.setLenient(True)接受格式错误的JSON 2022-01-01