Teach Your Kids To Code: A Parent-friendly Guide to Python Programming

(vip2019) #1

260 Chapter 10


next social media web application, coding is a skill that can change
your life.
You have the skills. You have the ability. Keep practicing, keep
coding, and go out there and make a difference—in your own life,
in the lives of the people you care about, and in the world.

What You Learned


In this chapter, you learned about elements of game design, from
goals and achievements to rules and mechanics. We built a single-
player Smiley Pong game from scratch and turned our SmileyPop
app into a game we could picture playing on a smartphone or tab-
let. We combined animation, user interaction, and game design to
build two versions of the Smiley Pong game and a second version of
SmileyPop, adding more features as we went.
In Smiley Pong, we drew our board and game pieces, added
user interaction to move the paddle, and added collision detection
and scoring. We displayed text on the screen to give the user infor-
mation about their achievements and the state of the game. You
learned how to detect keypress events in Pygame, added “game
over” and “play again” logic, and finished version 2.0 by making
the ball speed up as the game progressed. You now have the frame-
work and parts to build more complex games.
In SmileyPop, we started with an app that was already fun to
play with, added user feedback in the form of a popping sound using
the pygame.mixer module, and then added logic and a display to keep
track of the user’s progress as more bubbles are created and popped.
The apps you’ll create with your programming skills will also
start with a simple version, a proof of concept, that you can run
and use as a foundation for new versions. You can begin with any
program and add features one at a time, saving each new version
along the way—a process called iterative versioning. This process
helps you debug each new feature until it works correctly, and
it helps you keep the last good version of a file even when the new
code breaks.
Sometimes a new feature will be a good fit, and you’ll keep it
as the foundation of the next version. Sometimes your new code
won’t work, or the feature won’t be as cool as you expected. Either
way, you build your programming skills by trying new things and
solving new problems.
Happy coding!
Free download pdf