重用 cocos2d 动作

2024-08-11移动开发问题
4

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

The End

相关推荐

硬件音量按钮更改应用程序音量
Hardware Volume buttons change in app volume(硬件音量按钮更改应用程序音量)...
2024-08-12 移动开发问题
10

Cocos2d - 如何检查不同层中对象之间的交集
Cocos2d - How to check for Intersection between objects in different layers(Cocos2d - 如何检查不同层中对象之间的交集)...
2024-08-12 移动开发问题
8

突出显示朗读文本(在 iPhone 的故事书类型应用程序中)
Highlight Read-Along Text (in a storybook type app for iPhone)(突出显示朗读文本(在 iPhone 的故事书类型应用程序中))...
2024-08-12 移动开发问题
9

Cocos2D + 仅禁用 Retina iPad 图形
Cocos2D + Disabling only Retina iPad Graphics(Cocos2D + 仅禁用 Retina iPad 图形)...
2024-08-12 移动开发问题
10

正确的 cocos2d 场景重启?
Proper cocos2d scene restart?(正确的 cocos2d 场景重启?)...
2024-08-12 移动开发问题
7

[ios.cocos2d+box2d]如何禁用自动旋转?
[ios.cocos2d+box2d]how to disable auto-rotation?([ios.cocos2d+box2d]如何禁用自动旋转?)...
2024-08-12 移动开发问题
7