4.8 Conclusion
Hopefully, all of this code didn’t overwhelm you. These are the key takeaways from this lesson:
- Encapsulate game objects. You can do this by creating a base class that handles the common methods (in our case, the
draw
,move
, andcheck_collision
methods) and then having the specific objects inherit from the base class
- Set a clear structure for how your game class will run its main loop. This helps break down the challenge of making a game into easier tasks. (In our example, we broke down the main loop into
check_events
,check_collisions
,move_objects
, andupdate_display
)
Previous Section
4.7 - Practice ProblemsNext Section
Ch.5 - SoundsCopyright © 2021 Code 4 Tomorrow. All rights reserved.
The code in this course is licensed under the MIT License.
If you would like to use content from any of our courses, you must obtain our explicit written permission and provide credit. Please contact classes@code4tomorrow.org for inquiries.