🗒 Cheat Sheet← Lesson
BitWithBite
Pygame Mastery Worksheet

🎥 Camera System

Module 15 of 20 · Level ★★☆ · Time: 35 min
SCORE___ / 20
NameClassDate
After this worksheet you can
Build a camera offset systemImplement smooth camera followAdd screen shake and zoomBuild parallax backgrounds
📚 Quick Recap

A camera is just an (x,y) offset subtracted from world positions before drawing. Smooth follow lerps toward the target, screen shake adds temporary random offset, zoom scales a rendered surface, and parallax scrolls background layers at a fraction of the camera's speed.

🧠 Section A · Concept Check ● INTERMEDIATE 4 × 1 = 4

1What fundamentally is a 2D camera in Pygame?
2Why lerp the camera instead of snapping instantly?
3How does parallax create the illusion of depth?
4How can you achieve a zoom effect in Pygame?

🧮 Section B · Problem Solving ● INTERMEDIATE 2 + 3×3 = 11

5Screen shake adds a temporary offset to the camera.
6A depth factor of 0.2 means a background layer moves at % of the camera's movement.
7Write the apply() method that converts a world position to a screen position using camera.offset.
8Why should a mini-map use a smaller scale rather than the same camera offset math as the main view?
9Describe why screen shake magnitude usually decays over its duration rather than staying constant.

🚀 Section C · Challenge ● CHALLENGE 5

10Your game has 3 parallax layers (mountains depth 0.2, trees depth 0.5, gameplay depth 1.0) plus screen shake on hit. Explain how shake should combine with the camera offset so ALL layers shake together realistically, not just the gameplay layer.
💭 Reflection — the most useful thing I learned:
A ___/4   B ___/11   C ___/5   Total ___/20 Teacher's Signature Parent's Signature
✂ answer key — fold or cut before handing out

1-B   2-B   3-A   4-A  |  5 random   6 20   7 = def apply(self, pos): return pos - self.offset   8 = the mini-map needs to fit the whole level in a small corner of the screen, so positions must be scaled down by a much larger factor than the 1:1 main camera view uses   9 = decaying magnitude makes the shake feel like it's settling down naturally after an impact, rather than an abrupt, jarring on/off toggle  |  10 = compute the shake offset once per frame (a small random vector), then ADD it to camera.offset itself (not to each layer separately) — since every layer's draw position is derived from the same shared camera.offset, adding shake to that one value automatically shakes every layer together in sync

📄 Need offline practice?Download the print-ready PDF or open the one-page cheat sheet.
⬇ Worksheet PDF 🗒 Cheat Sheet