Can I reuse an Animate object in cocos 2d-x for generated Sprites?

I'm having a cocos2d-x game and inside i generate a Sprite that has a frame Animate. I don't want to create every time this animation so I've tried to make it globally and make object->runAction('myGlobalAnimate') but when a new object is created the frame animation stops from the previous Sprite. How can I use the same Animate to all my nodes (to make this game efficient and resources friendly)?

Answers


I think that that you have to clone it Like this:

object->runAction('myGlobalAnimate'->clone());

Give it a try,


Need Your Help

creating object from array in php

php arrays api

I need to be able to create an object from an array. The data is coming from a terrible API. Here is an example of the data.

Filtering XML with XPath based on content of child elements

c xml xpath libxml2 onvif

I need to filter the response of a SOAP web-service. Since SOAP is based on XML, I am thinking about using libxml2, but I am not able to understand how to write an XPath expression to achieve the d...