-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalien_invasion.py
More file actions
40 lines (30 loc) · 1.15 KB
/
Copy pathalien_invasion.py
File metadata and controls
40 lines (30 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import sys
import pygame
from settings import Settings
from ship import Ship
class AlienInvasion:
"""Class to manage assets and behavior"""
def __init__(self):
"""Init the game, generate game resources"""
pygame.init()
self.settings = Settings()
self.screen = pygame.display.set_mode((self.settings.screen_width,
self.settings.screen_height))
pygame.display.set_caption("OH NOEZ ALIENZ!")
self.ship = Ship(self)
def run_game(self):
"""Start the main loop for the game"""
while True:
# Watch for mouse/kb events
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
# Redrawing the screen each pass through the loop.
self.screen.fill(self.settings.bg_color)
self.ship.blitme()
# Make the most recently drawn screen avaliable
pygame.display.flip()
if __name__ == '__main__':
# Make a game instance, and run the game.
ai = AlienInvasion()
ai.run_game() # LOL FORGOT PARENS HERE DIDNT WORK KTHNX