Program Arcade GamesWith Python And Pygame
Lab 9: Sprite Collecting
This lab practices using Pygame sprites as described in Chapter 14.
- Start with an empty directory and put all of the lab-related files in this directory.
- Start with the following program:
ProgramArcadeGames.com/python_examples/f.php?file=sprite_collect_blocks.py - Modify it so the player moves with the keyboard rather than the mouse. Take a look at the move_sprite_keyboard_smooth.py program also available on the example page.
- Create another list of sprites, one that decreases the player score instead.
- Color the player blue, the good sprites green, and the bad sprites red. Or use graphics to signify good/bad sprites as shown in the sprite_collect_graphic.py example file.
- Rather than simply use print to display the score on the console, display the score on the graphics window. Go back to simple_graphics_demo.py for an example of displaying text.
- Add sound effects for when the user hits good blocks, or bad blocks. Here are a couple
from OpenGameArt.org:
ProgramArcadeGames.com/labs/sprite_collecting/good_block.wav
ProgramArcadeGames.com/labs/sprite_collecting/bad_block.wav - Add a check and make sure the player doesn't slide off the end of the screen.
- Download a wav file and have it play a sound if the user tries to slide off the screen. Here's one
sound you can use:
ProgramArcadeGames.com/labs/sprite_collecting/bump.wav
You are not logged in. Log in here and track your progress.
Copyright © 2013
English version by Paul Vincent Craven
Russian version by Vladimir Slav
Turkish version by Güray Yildirim
English version by Paul Vincent Craven
Russian version by Vladimir Slav
Turkish version by Güray Yildirim