Solved LibGDX Displaying Textures

Hi!

I am looking for a bit of advice on displaying textures in LibGDX. In this case, I am using a sprite batch to display everything. Whenever you have an object, lets say an enemy, each of them individually inside of an array, how do you display them all with one line? I’m assuming like so:


for(int i = 0; i < array.length; i++){
sb.draw(texture, array[i].x, array[i].y, array[i].width, array[i].height); // Each object having an x, y, width, and height of course.
}

While it seems like it would work, is this the conventional way of doing it? I always want to use the proper methods for performance boost.

Thanks!

  • A