leopardpm wrote:First, I must say that I REALLY appreciate how well you comment your code and how clean and straightforward it is - this makes it so amateurs like me have a chance of understanding the inner workings of whats occurring - Thank you!
You're welcome. Commenting code as if I were explaining it to somebody else who has NO idea of what the code is doing is something some of my mentors taught me a long while ago. Because, three months from when you wrote the code, the one that won't have any idea of what the code does will be yourself =D
leopardpm wrote:Basically, each animation bitmap is only stored once:
And every 'agent' which uses that animation just maintains an index to which frame that particular agent is currently showing.
This way you could have 100 elves walking around, each having their individual frames advancing at different rates, yet still only uses one animation bitmap
is that what you are showing in your animation class demo?
Yes, that's one of the things shown there, but it's not the most important bit. The real gist of the demo is how you can control multiple agents, all with their own timings, and how to maintain them. If you press 'p' in the demo, you'll see that the elf pauses both its movement AND its timings, which are restored upon resuming the processing of the animation.
What you call 'timed events' is usually called a process in a cooperatively multitasked model. Implementing one isn't particularly hard, and will give you the flexibility to code anything you can dream of without much hassle (the very first OSses were laid out this way).
Some other links that can help you:
Perfectly accurate game timing. If you positively, absolutely have to have control over the last tick of your game.
Entity-Component-System. This is how modern games (for desktops at least) are laid out. Check it out because you can implement this model without resorting to OOP (although I'd recomend to do so).
I have some code to illustrate this, but I'm afraid that's all object-oriented so it's of no use to you.