But we can do better than that.
We can make MySprite animate itself.
Why would we want to do that?
Imagine a program with lots of different objects, all animated in different ways. Imagine you want to be able to stop and start each animation. Doing so via separate timers would quickly become a tangle.
By embedding the knowledge of animation within MySprite, every sprite can take care of its own details.
|