更新时间:2021-07-09 19:35:30
封面
版权信息
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Chapter 1. Welcome! Let's Get Started
Python projects for you
The prerequisites of Python
Write and run your first program in the command line
Make yourself a work folder
A quick task for you
Summary
Chapter 2. Variables Functions and Users
Variables
Functions
Users interacting with your program
Using the text editor and the command line
Build your own function – name()
Going the extra mile
Chapter 3. Calculate This!
The calculator
Basic functions
Operations on two numbers
New functions – subtraction multiplication and pision
Finding a remainder – modulo
Running your program
Chapter 4. Making Decisions – Python Control Flows
Is it equal not equal or something else?
Conditional statements – if elif else
Loops
Chapter 5. Loops and Logic
Higher or Lower
Chapter 6. Working with Data – Lists and Dictionaries
Lists
Dictionaries
List or dictionary
Chapter 7. What's in Your Backpack?
Setting up our coding environment
Planning to program your game
Skills needed to make a program
Score play again or quit?
Getting and storing player information
Adding items to the virtual backpack
Limiting items in a virtual backpack
Testing your code so far
A game loop
Bringing back the while loop
Comparing guesses with backpack items
Keeping score
Ending the game
Testing your game
Chapter 8. pygame
What is pygame?
Installing pygame
pygame
Chapter 9. Tiny Tennis
Introduction to game programming principles
The game plan
Creating an outline of game parts
Section 1 – imports globals and drawings
Initializing the score
Testing section 1
Section 2 – moving the paddles
The increase and decrease value (-= and +=)
Testing section 2
Section 3 – moving the ball
Testing – section 3
Section 4 – draw screen and track the score
Ending the program
Play Tiny Tennis!
Chapter 10. Keep Coding!
What we learned and your next steps
Classes and objects – very important next steps!
More fun with games
Adding music to games
Adding graphics to games
Remake or design games
Other games
Other uses of Python
Coding challenges
Appendix A. Quick Task Answers
Chapter 1 Welcome! Let's Get Started