0

I am using cocos2d-android and eclipse, language is java.

I have an arraylist of sprites (maximum of 50 sprites) that I generate at the start of my game. I delete the sprites when their positions are off-screen. I want to add new ones (to the arraylist) when a sprite is deleted but the y position of the new sprite is above the last sprite in the arraylist. I can generate new sprites but I can't get the y position to be above the last sprite in the arraylist.

Thank you in advance for the suggestions and answers.

1 Answers1

0

Consider using LinkedList instead of ArrayList. Look at its addLast, getLast and removeLast methods. Hope I understood your problem ;)

Viacheslav Rodionov
  • 2,335
  • 21
  • 22