« All Events
6 PM – Python Game Development – Sebastian
October 24, 2023 @ 6:00 pm - 7:00 pm
Today We Did
- Handled collisions for all objects
- Created giant fireballs with full functionality
- You can always find the code we wrote in class in my Gitlab repository here:
https://gitlab.com/gsugiart/tue-6-pm-dragon-birdie/-/tree/TUE-6PM-Sebastian - In case you need anything, feel free to email me at sebastian@ayclogic.com
Homework
- Homework: Inside main.py, add a new method called “player_bird_collision” which will handle collisions between the Player & any Bird.
- Create method player_bird_collision (what parameters?)
- If either rectangle collided with each other
- Set game mode to GAME_LANDING_PAGE
- Play pop sound effect
- return True
- if rectangles didn’t collide
- Simply return False
- When we handle our group collisions between the bird and player group:
pygame.sprite.groupcollide(self.player_group, self.bird_group, True, False)
Pass in our new method - You’ll know everything works if pop sound effects are played when players collide with birds (which ends the game).