Glossary β Look Up Any Word In the Code
Every comment in catch.py tells you what a line does. This tab is for when you need to know what a word means β check here any time a term in the code or guide doesn't ring a bell yet.
Game loopThe while running: block that repeats forever, once per frame, running INPUT β UPDATE β RENDER in order.
FrameOne single pass through the game loop β one input check, one update, one redraw. A "60 FPS" game does this 60 times a second.
pygame.init()Starts up every pygame subsystem (graphics, sound, input) β the first line of almost every pygame program.
SurfacePygame's word for anything you can draw on. The screen returned by set_mode() is a Surface; so is every image you load.
Event queueA list pygame builds of everything that happened since the last frame β key presses, clicks, the window's close button. pygame.event.get() reads and empties it.
RectShort for "rectangle." Stores an object's x, y, width, and height, and gives you .left .right .top .bottom .colliderect() for free.
Clockpygame.time.Clock() β an object that measures how much real time has passed between frames.
clock.tick(60)Pauses just long enough to cap the loop at 60 frames per second, then returns how many milliseconds the last frame actually took.
dt (delta time)Short for "delta time" β the length of the last frame, in seconds. Multiplying speeds by dt keeps movement the same real-world speed no matter how fast or slow the computer runs.
Collision detectionCode that checks whether two objects are touching β in this lesson, player.colliderect(ball).
AABB"Axis-Aligned Bounding Box" β the fast rectangle-overlap test colliderect() runs under the hood: four true/false comparisons, all four must pass for a hit.
screen.fill()Paints the entire window one solid color, erasing last frame's drawing before the new one is drawn.
pygame.display.flip()Shows everything drawn so far on the actual screen. Nothing the player sees updates until flip() runs.
StateAll the values that describe the game right now β player position, ball position, score. UPDATE changes it; RENDER just draws whatever it currently is.