This section will cover how do detect collisions between game items such as players, enemies and obstacles.
1. Read and work through "Part 12 - Detecting Collisions".
GitHub solutions are here:
2. Complete the suggestions at the end of each section.
3. You will submit the program along with as many challenges that you can complete for Part 2 - Colliding Rectangles.
1. The Python file that you created for "Part 2 - Determining if 2 Rectangles Collide" of the tutorial, including challenges.
1. Detecting Collisions: It is important to mention here that we are not actually using "Sprites" in Pygame in these example programs. We will look at another way of detecting collisions using real Pygame "Sprites" in a later section. Here we use the Pygame Rect (meaning Rectangle) (https://www.pygame.org/docs/ref/rect.html) class to store the location and size data of each character or item that we are going to display. The Rect for each character/item is passed to the blit method, along with the image so that it can be drawn. This Rect class has built in functionality to detect collisions between rectangles along with other built in functionality. See the API for the Rect class for more: https://www.pygame.org/docs/ref/rect.html.