Every time you modify circle inside onKeyPress , you must write global circle . If you forget, Python creates a local variable named circle , and the actual circle on screen never moves.
Are you a stuck on a bug or a teacher looking for lesson planning tips?
Students define dx (delta x) and dy (delta y) to determine how many pixels an object moves per frame. 6.3.5 Cmu Cs Academy
Below is a guide on the concepts taught in this section and a walkthrough for a standard "Shape Mover" exercise.
Here is an article-style guide covering the concepts and likely objectives of Exercise 6.3.5. Every time you modify circle inside onKeyPress ,
version, the goal is to move three polygons from the corners of the canvas toward the center to form a triangle while rotating them. 1. Identify the Polygons The exercise provides three polygon objects: bottomLeft bottomRight . Each needs its own movement and rotation logic inside the 2. Move the Top Polygon polygon starts at the top and moves downward. (top.centerX < ): top.rotateAngle += top.centerX += top.centerY += Use code with caution. Copied to clipboard 3. Move the Bottom Left Polygon This piece moves from the bottom left toward the center. (bottomLeft.centerX < ): bottomLeft.centerX += bottomLeft.rotateAngle += bottomLeft.centerY -= # Moves up Use code with caution. Copied to clipboard 4. Move the Bottom Right Polygon This piece moves from the bottom right toward the center. (bottomRight.centerX > ): bottomRight.centerX -= bottomRight.rotateAngle -= bottomRight.centerY -= # Moves up Use code with caution. Copied to clipboard 5. Final State Logic
CMU CS Academy uses a graphics-based approach to teaching Python. In , students move beyond static shapes to create interactive scenes that respond to time and user input. Exercise 6.3.5 specifically focuses on: Students define dx (delta x) and dy (delta
Section 6.3.5 heavily relies on boundaries and state changes. Students must use if , elif , and else statements to determine when a graphic should change. For example, if a custom counter reaches a specific number, the background color might shift, or a character's expression might change. 3. Custom Functions with Parameters
The logic in 6.3.5 demands precise condition checking. You will likely need to use compound conditionals with logical operators ( and , or , not ) to determine exactly when a shape should change color, move, or disappear. Step-by-Step Approach to Solving 6.3.5