Playing background music

Background music is meant to play in the background while the game is being played. So once you start the background song, Pygame has to get ready to do other things, like moving sprites around or checking the mouse and keyboard for input. It doesn't wait for the song to finish. But what if you want to know when the song ends Maybe you want to start a different song or play another sound like we want to do . How do you know when the music is done Pygame has a way to tell you you can ask the...

Bump Collision detection

In most computer games, you need to know when one sprite hits another one. For example, you might need to know when the bowling ball hits the pins or when your missile hits the spaceship. You might be thinking that, if we know the position and size of every sprite, we could write some code to check those against the position and size of every other sprite, to see where they overlap. But the folks who wrote Pygame have already done that for us. Pygame has what's called collision detection built...