Inside the onStep() function, you update the object's position by adding these dx and dy values to its current center coordinates. icon.centerX += icon.dx icon.centerY += icon.dy 3. Implement Boundary Bouncing
Summary
: Instead of jumping to a coordinate, shapes move by a small amount (often stored as a custom property like dx or dy ) during every step. 6.3.5 Cmu Cs Academy
def onKeyRelease(app, key): # Check if the Right Arrow was released if key == 'right': app.movingRight = False Inside the onStep() function, you update the object's
Sometimes, the exercise involves moving a rectangle, changing colors on a keypress (e.g., pressing "r" for red, "b" for blue), or printing the key name to the console. However, the most common version is . Inside the onStep() function
Weaknesses