We can also add behaviours (called methods) to our object.
Every sprite in our program is going to need to draw itself for each frame, so we add the drawing behaviour as a method of MySprite.
Then, in our Do_a_Frame function, we can just call:
In a later lesson, we'll add gravity and bounciness to our MySprites, and the really cool thing is that we only have to add it in one place, and all our MySprites automatically get it.
|