I’m currently working on a “sprite” class, intended to somewhat mirror the “Actor” class: it plays, loops, etc.
As part of that, naturally, it has updating to do–and this is where I’m uncertain.
For the most part, I tend to design features to work from a central “update task”, which calls “update” methods on any relevant objects, which in turn call “update” methods on any relevant sub-objects, and so on.
But of course, Actor doesn’t work that way: it updates silently in the background somewhere.
And it’s tempting to do the same for this “sprite” class: to have the sprite’s updating be something that the developer doesn’t have to worry about.
The obvious thought for implementing this, then, is to have each sprite-object create a task to be run each frame, which performs its update-logic.
But… that seems like an awful lot of tasks, potentially! Is that… wise…?
Alternatively, I suppose that I could have a manager class that runs a single “update” task, and which then iterates over a list of all sprites. But that seems like it could be a long list, and such a system feels fragile in having to keep in sync which sprites are still valid…
So, does anyone have any thoughts on this…?
Turning back to Actor, I… don’t see where it’s calling its update function. Does anyone know where this happens?