I am making an attempt to create a sport for a college mission. In the principle menu, i animated a personality with this:
spidey = new Texture("spidey.png");
TextureRegion[][] tmpFrames =
TextureRegion.break up(spidey,spidey.getWidth()/3,spidey.getHeight()/5);
animationFrames = new TextureRegion[15];
int index = 0;
for (int i=0; i<5; i++){
for (int j=0; j<3; j++){
animationFrames[index++] = tmpFrames[i][j];
}
}
animation = new Animation(0.15f, (Object[]) animationFrames);
But when i’ve an array of character like this:
public void characters() {
enemies = new Array<Enemy>();
enemies.add(new Enemy(new Sprite(new Texture("img1.png")), spawn));
enemies.add(new Enemy(new Sprite(new Texture("img2.png")), spawn));
enemies.add(new Enemy(new Sprite(new Texture("img3.png")), spawn));
enemies.add(new Enemy(new Sprite(new Texture("img4.png")), spawn));
}
How am i able to animate all character?