I'm wondering how I would implement linked lists into a game. I use a sort of linked list, but you can't add and delete things. I create a pre-defined number of variables of the same type, and hold the address of the next one. The list size doesn't change during the game, but each one has a flag set to true or false that says whether or not to do anything with it.
Would it be more efficient to use a linked list for this sort of thing? Instead of setting that flag to true or false you just add/delete a node, right? Get what I mean?
For example, pretend you had a game with bouncing balls, and you wanted two balls going at once. To do this, I would declare two variables of my struct type, and have a member variable called next, and set them to point to eachother. Then have a flag that is set to true of false (which represents if it is "active" or not). I'm thinking it would be more efficient to use a linked list, and when we need another ball, just add one to the linked list. Then in my drawing routines, collision checking routines, etc. you would just traverse throught the list and perform all actions on each node in the list. Then when I check for the ball disappearing, instead of changing its flag you just delete the node.
With that method, I wouldn't need to declare [unneeded] variables at the beginning of my program.
1) Is this a common / efficient way to implement linked lists into a game?
Secondly, classes. For all my past projects, I've used structs and not classes. I never read a single thing about classes, except very basic things.
2) What are some advantages of using classes vs. structs in any type of program?
Thirdly, animations. The way I've come to do animations thus far (not moving a bitmap), is to do this. Give each variable of whatever type (a ship, block, person) of variable you have a bool that stands for if it should be animating or not. Then an int that holds which frame it is on.
3) Is this a good way to handle animations? Is there a common method used to do things like this when there are large numbers of objects that might possibly need to be animated?
I'm getting to the point where I have to manage large amounts of common "objects" modularly. Organization is pertinent. Thanks for any responses.