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 动作


基础教程推荐
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01