I seem to be having problems with some sprites in my game. The number of them isn't the same from level to level, so I have created an ArrayList of these sprites to get a variable number of them.
Now, simply for some testing purposes (I'm not yet at the point that I am going to program their behavior) I am trying to get one to move on a keypress. However, it keeps freezing the program, and I realized that you don't access ArrayList members the same way that you do an Array.
I mean, if it were an Array, it would be no problem to make one move with
However, when calling the same function from an ArrayList,
I'm actually creating another intstance of that sprite. Which is what I believe it the source of the problem.
So, how can I get a member of an ArrayList to do something, without copying said member?