public void update(float delta) { timer -= delta; if (timer <= 0) { currentTexture++; if (kill) if (currentTexture > numTextures) parent.setRemovable(); currentTexture = currentTexture > numTextures ? 1 : currentTexture; TextureRegion r = atlas.findRegion(caller + (currentTexture)); parent.setRegion(r); timer = countDownTime; } }
private void init(TextureAtlas atlas, String caller, int framesPerSecond, GameObject parent) { this.atlas = atlas; this.caller = caller; this.parent = parent; currentTexture = 1; numTextures = atlas.getRegions().size; countDownTime = 1f / (float) framesPerSecond; timer = countDownTime; TextureRegion r = atlas.findRegion(caller + 1); parent.setRegion(r); }