Lab 9: Sprites and Walls¶
Goal: Create a landscape of wall objects that the user must navigate around to
collect coins. This will help practice using
for loops to create
and position multiple items.
- Step 1: Start with one of the move with walls examples. Use either the Move with Walls example or the Move with a Scrolling Screen example.
- Step 2: If you start with the examples, delete the current wall placement code. You want to create your own.
- Step 3: Create a more complex arrangement of walls. Make sure the walls don’t allow the user to go off-screen. 6 points, based on how complex the arrangement. See Individually Placing Walls, Placing Walls With A Loop, and Placing Walls With A List for ideas. Just DON’T do the same thing as examples. Make it your own.
- Step 4: Update the graphics. Use multiple types of blocks for the walls. Maybe change the character. 4 points, one point for each graphic used that wasn’t part of the base example.
- Step 5: Add coins (or something) for the user to collect. 4 points, based on the complexity of the coin layout.
- Step 6: Keep score of how many coins were collected, and display on-screen. 4 points.
- Step 7: Add a sound to play each time the user collects a coin. 2 points.
Don’t move the player twice!
self.physics_engine.update() moves the player while checking
for walls. The command
self.all_sprites_list.update() will move the
player WITHOUT checking for walls. Don’t do both commands. You’ll end up
“walking through walls.” If you have other
sprites to update, update only those sprites. For example: