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

Lesson 13: The First Alien โ€” One Alien on Screen (Matthes Ch 13 ยง1-2)

Learning Intentions

Success Criteria

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

Download alien.bmp from the hub's checkpoints folder. Open your Ship class. Look at every line โ€” which lines will change for an Alien class, and which can stay identical?

๐Ÿ‘ I Do โ€” Teacher Demo

Live-code the Alien class (almost a copy of Ship โ€” different image, different starting position). Add self.aliens = pygame.sprite.Group() to Game, call self._create_fleet(). For today, _create_fleet just adds ONE alien.

๐Ÿค We Do โ€” Build Together

Class builds Alien + places one on screen together. Highlight how much was copy-paste from Ship. 'Pattern reuse' is a core programmer skill.

๐Ÿš€ You Do โ€” Your Turn

Make sure ONE alien appears top-left. Experiment โ€” move it to centre or top-right. Arcade quests cover class reuse + positioning.

  • Create alien.py with class Alien(Sprite)
  • Load alien.bmp + get_rect() (exactly like Ship)
  • In Game.__init__: self.aliens = pygame.sprite.Group(); self._create_fleet()
  • _create_fleet (for now): just create ONE Alien and add it to self.aliens
  • Call self.aliens.draw(self.screen) in _update_screen

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

Loading practice quests for this lesson...

Three tiers โ€” pick yours

Support

alien.bmp provided; fill in 2 lines in Alien.__init__

Core

write class from scratch

Extension

2 alien files + random choice

Extensions

๐Ÿ“ Exit Ticket โ€” Coding Journal

Journal: 1 sentence on how Alien is similar to Ship. How does inheritance save typing?

Evidence of Learning

One alien sprite visible top-left of screen.

โ† PreviousLesson L12โ†‘ HubAll LessonsNext โ†’Lesson L14