start alien invasion project
This commit is contained in:
parent
6d3f2f90cc
commit
cb62ec7f68
24
Projects/Alien_Invasion/alien_invasion.py
Normal file
24
Projects/Alien_Invasion/alien_invasion.py
Normal file
@ -0,0 +1,24 @@
|
||||
import sys
|
||||
import pygame
|
||||
|
||||
class AlienInvasion:
|
||||
"""Overall class for the game"""
|
||||
def __init__(self):
|
||||
"""Initialize game and create resources"""
|
||||
pygame.init()
|
||||
self.screen = pygame.display.set_mode((800, 600))
|
||||
pygame.display.set_caption("Alien Invasion")
|
||||
def run_game(self):
|
||||
"""Start main game loop"""
|
||||
while True:
|
||||
#Listen for events
|
||||
for event in pygame.event.get():
|
||||
if event.type == pygame.QUIT:
|
||||
sys.exit()
|
||||
# refresh display
|
||||
pygame.display.flip()
|
||||
|
||||
if __name__ == '__main__':
|
||||
# Create game instance and run game
|
||||
ai = AlienInvasion()
|
||||
ai.run_game()
|
||||
Loading…
x
Reference in New Issue
Block a user