java - LibGdx What is the proper way to copy an Actor? -


i have custom implementation of image animates. want make multiple copies of instance of class using minimum memory , processor time rendering , copying. how go it? easiest recreate whenever need 1 or there proper or suggested method copying image instances. ask because can't find copy constructor , don't know if .clone() implemented in image.

if want take care memory can give actors same image. if change image in way , @ 1 of actors change @ actors it(i did sprite , changed textureregion. monsters looked @ same direction). if have same image whole time can create objects , give same reference 1 image.
for example this:

public arraylist<actor> generateimageactor(){         arraylist<actor> temp = new arraylist<actor>();         image img = new image(____);         for(int = 0; <10; i++){             myactor act = new myactor(img);             temp.add(act);         }         return temp;     } 


the rendertime not effect if refare 1 image or new image. take picture , offsett , draws it. if refare 1 image @ 10 actors has same rendertime else if have 10 actors copy of image.
hope helps.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -