| | |
Need Help About ArrayList of Sprites ?
![]() |
•
•
Join Date: Apr 2009
Posts: 6
Reputation:
Solved Threads: 0
Hi Friends,
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
array[i].move();
However, when calling the same function from an ArrayList,
arraylist.get(i).move();
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?
Thanks
Jay
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
array[i].move();
However, when calling the same function from an ArrayList,
arraylist.get(i).move();
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?
Thanks
Jay
![]() |
Similar Threads
- Using operator[] with an ArrayList (Java)
- Is ArrayList Better than Vector (Java)
- Storing Point2D.Double objects in an ArrayList. (Java)
- Need Help with ArrayList sorting (Java)
- Game sprites (Geeks' Lounge)
- Linked arraylist (Java)
Other Threads in the Game Development Forum
- Previous Thread: OpenGL - Problems with zoom in/zoom out
- Next Thread: Help About Tower Defense Game?
| Thread Tools | Search this Thread |
3d advertising ai algorithm ban c++ cambridge camera censorship china competition console development engine fov fpx game gamer games gaming gauntanamo government idaho in-gameadvertisement intellectualproperty l-systems laracroft lindenmayer live manhunt math mathematics matrix mercenaries microsoft mmorpg modded msn naked news nintendo obama opengl palin physics pirate playstation politics projection ps3 rpg search selection software sony stephenhawking stocks studio technology terrorism tombraider uk videogame web wii world-of-warcraft xbox xbox-live xbox360






