问题描述
对于使用相同动作的多个 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 动作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!