A method called setRegion() sets the current animation frames of the object:
protected void setRegion(String name, float frameDuration) {
currentFrame = atlas.findRegion(name, 0);
if (currentFrame == null) {
currentFrame = atlas.findRegion(name, -1);
}
width = currentFrame.getRegionWidth();
height = currentFrame.getRegionHeight();
animationStateTime = 0;
animation = new Animation(frameDuration, atlas.findRegions(name), Animation.PlayMode.LOOP);
}
And in the update() of the objects this is called:
currentFrame = (TextureAtlas.AtlasRegion) animation.getKeyFrame(animationStateTime, isLooping);
The getCurrentFrame() method only returns currentFrame variable. The alpha is a field with a value between 0 and 1. (getAlpha() returns only the field)
My question is that considered a "heavy" activity? Can this be a significant impact on the FPS values? Because I'm running my game on old devices (like Galaxy S2) and the FPS can get pretty low values. I'm trying to find the cause to it.
I used to have a reference to every list but with the time I realized I'm going to have too much lists, so I decided to do it like this. Maybe you know a better way of holding references to all game objects?