android - Libgdx - Actions; adding one action to multiple actors -


i have defined set of actions , trying add multiple actors. here's code:

        parallelaction actions = new parallelaction();          rotatebyaction rotateaction = new rotatebyaction();         rotateaction.setamount(rotationamount);          scalebyaction scaleaction = new scalebyaction();         scaleaction.setamount(-0.01f);          delayaction delayaction = new delayaction();         delayaction.setduration(0.05f);          repeataction raction = new repeataction();         raction.setcount(100);          actions.addaction(rotateaction);         actions.addaction(scaleaction);         actions.addaction(delayaction);         raction.setaction(actions);            for(monster mon : mons) // mons arraylist of type monster (which extends image)             mon.addaction(raction);  

but above logic adds action last actor in arraylist. why can't use same action multiple actors? need define many actions actors, or there other way it?

i looked upon pool here https://code.google.com/p/libgdx/wiki/scene2d don't seem hold of it. useful problem? if yes, how?

because actors habe reference 1 sequence. every actor have sequence same. example if use 1 sprite 10 actors , change in 1 actor every other actor have changing too. if add sequence 10 actors speed 10 times because every .act() actors update sequence (because inside of every actor.act update actions delta time!). update sequence every actor thats why not work. need create new squence every actor thats right. change code this:

for(monster mon : mons){ // mons arraylist of type monster (which extends image)         rotatebyaction rotateaction = new rotatebyaction();         rotateaction.setamount(rotationamount);          scalebyaction scaleaction = new scalebyaction();         scaleaction.setamount(-0.01f);          delayaction delayaction = new delayaction();         delayaction.setduration(0.05f);          repeataction raction = new repeataction();         raction.setcount(100);          actions.addaction(rotateaction);         actions.addaction(scaleaction);         actions.addaction(delayaction);         raction.setaction(actions);         mon.addaction(raction);  } 

this may take longer @ init should correct bug.


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -