-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
60 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import pygame | ||
from pygame.sprite import Sprite | ||
|
||
class Alien(Sprite): | ||
"""A class to represent a single alien in the fleet""" | ||
|
||
def __init__(self, ai_game): | ||
"""Init the alien & set it's starting position""" | ||
super().__init__() | ||
self.screen = ai_game.screen | ||
self.screen = ai_game.screen | ||
|
||
# Load the alien image and set it's rect attrib | ||
self.image = pygame.image.load("images/alien.bmp") | ||
self.rect = self.image.get_rect() | ||
|
||
# Start each new alien near the top left of screen | ||
self.rect.x = self.rect.width | ||
self.rect.y = self.rect.height | ||
|
||
# Store the alien's exact horizontal position | ||
self.x = float(self.rect.x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters