/** * To retrieve the current image index that is currently animating and then updating the current * to the next image * * @param id */ public void changeCurrIndex(Integer id) { // gives the animation name give the entity id String animation = mCurrentAnimation.get(id); // gets the actual array assoc with the name CircularArray<Texture2> arr = mReelsNameAssoc.get(animation); // checks if the key is in the hash table if (mUpdateCurrAni.containsKey(id)) { int imgIndex = mUpdateCurrAni.get(id); // Retrieve the last draw's image index mUpdateCurrAni.remove(id); // remove it if (imgIndex < arr.size() - 1) { // check if the current index is still within bound imgIndex++; // increment the index mUpdateCurrAni.put(id, imgIndex); // put next index in } else { imgIndex = 0; // when we are at the last index wrap back to the beginning } } else { // else is it not in the table we add with the index being 0 mUpdateCurrAni.put(id, 0); } }