重用cocos2d操作 [英] Reuse cocos2d actions

查看:103
本文介绍了重用cocos2d操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有可能(和一个好的做法)为使用相同操作的多个CCSprites重复使用相同的操作吗?

Is it possible (and a good practice) to reuse the same actions for multiple CCSprites that use the same action?

如果我有10个CCSprites,所有都需要缩放。我创建一个称为scaleAction的缩放操作。是否可以为sprite重复使用相同的动作?

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?

当我试图这样做,我只有一个sprite缩放,而不是所有。

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?

提前感谢

推荐答案

由于问题询问是否为多个sprite重新使用一个动作,答案是一个明确的:

Since the question asks about re-using one action for multiple sprites, the answer is a clear: no.

每个sprite必须运行自己的动作。如果有一个已在节点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操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆