Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Python Projects for Kids

You're reading from   Python Projects for Kids Unleash Python and take your small readers on an adventurous ride through the world of programming

Arrow left icon
Product type Paperback
Published in Apr 2016
Publisher Packt
ISBN-13 9781782175063
Length 192 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Jessica Ingrassellino Jessica Ingrassellino
Author Profile Icon Jessica Ingrassellino
Jessica Ingrassellino
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Welcome! Let's Get Started 2. Variables, Functions, and Users FREE CHAPTER 3. Calculate This! 4. Making Decisions – Python Control Flows 5. Loops and Logic 6. Working with Data – Lists and Dictionaries 7. What's in Your Backpack? 8. pygame 9. Tiny Tennis 10. Keep Coding! A. Quick Task Answers Index

Section 2 – moving the paddles


Now we finally get to write the code that will make our paddles appear on the screen and allow us to control the paddle.

This is where we get the chance to use the logic and loops that we learned about in earlier chapters. In a game such as Tiny Tennis, many decisions are made very quickly. Computers are great at making fast decisions based on our instructions. Here are the parts of the code that will be in the next section:

  • Creating the while loop

  • Key events

We will code these next pieces step by step, and then test the code by running it to check whether there are any errors. It is suggested that you read through this whole section before you start coding so that you know what to expect. Once you have read through everything, the fun starts!

Pre-loop actions

Before we actually create the while loop, there are two actions that we will code. The first is to ensure that the cursor disappears when it goes over the game screen, so it is not an interruption. There is...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime