L16 ยท T2 Week 8 ๐ŸŽฏ CT5-DPM-01 ยท CT5-THI-01 ๐Ÿ“‚ Phase 2 โ€” Alien Invasion ยท Ch 13 Aliens

Lesson 16: Shooting Aliens โ€” groupcollide + Fleet Respawn (Matthes Ch 13 ยง5)

Learning Intentions

Success Criteria

๐Ÿ“ Do Now โ€” Error of the Day

Predict: pygame.sprite.groupcollide(bullets, aliens, True, True) โ€” what does it return if 2 bullets hit 3 aliens? (Dict? List? Integer?)

๐Ÿ‘ I Do โ€” Teacher Demo

Live-code _check_bullet_alien_collisions(). Print the groupcollide return value to see it IS a dict. Add the respawn pattern if not self.aliens: ... self._create_fleet().

๐Ÿค We Do โ€” Build Together

Class wires up collisions. Shoot aliens โ€” they disappear. Clear the fleet โ€” new fleet respawns. Pure satisfaction.

๐Ÿš€ You Do โ€” Your Turn

Tune ship_speed, bullet_speed, alien_speed to find the 'feel' you like. Arcade quests cover groupcollide + respawn patterns.

  • Add self._check_bullet_alien_collisions() call after self.bullets.update()
  • Inside: pygame.sprite.groupcollide(self.bullets, self.aliens, True, True)
  • If not self.aliens: self.bullets.empty() + self._create_fleet()
  • Tune speed values โ€” does the loop feel good?

๐ŸŽฎ Practice Quests โ€” work through these

Loading practice quests for this lesson...

Three tiers โ€” pick yours

Support

collision code pre-written

Core

write from scratch

Extension

piercing + indestructible alien variants

Extensions

๐Ÿ“ Exit Ticket โ€” Coding Journal

Journal: what did it feel like when your first alien disappeared from a bullet hit?

Evidence of Learning

Playable: shoot aliens, see them disappear, fleet respawns when clear.

โ† PreviousLesson L15โ†‘ HubAll LessonsNext โ†’Lesson L17