复制CCSprite? (cocos2d)

发布于 2024-10-03 19:49:34 字数 171 浏览 1 评论 0原文

我正在尝试复制一个已子类化的 CCSprite。假设该文件名为 Names。原来的变量名为 bob。如果你想复制鲍勃的所有动作,你会怎么做?我的意思是复制一个 CCSprite 并使其具有与原始 CCSprite 相同的操作和属性。我想我必须将操作添加为属性?你怎么做到的?我需要能够多次复制“bob”。

谢谢!

I'm trying to copy a CCSprite that's been subclassed. Let's say the file is called Names. And the original variable name is bob. If you wanted to copy all the actions of bob, how would you do that? By that I mean duplicating a CCSprite and have it have the same actions and attributes the original one has. I think I have to add the action as a property? How do you do that? I'd need to be able to copy "bob" many times.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

陌伤ぢ 2024-10-10 19:49:34

所有操作都存储在CCActionManager中。目前还没有功能可以获取与对象关联的所有操作,但您可以添加一个方法来执行此操作 - 请查看 GetActionByTagNumberOfRunningActionsInTarget

获得操作列表后,您可以执行并复制它们。您需要为精灵子类以及动作编写一个复制函数。

All actions are stored in the CCActionManager. There isn't functionality right now to get all of the actions associated with an object but you could add a method to do so - look at GetActionByTag and NumberOfRunningActionsInTarget.

Once you get a list of the actions you can go through and copy them. You'll want to write a copy function that for the sprite subclass as well as the actions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文