diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000..105ce2d
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..d56657a
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..aef2996
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/python-crash-course.iml b/.idea/python-crash-course.iml
new file mode 100644
index 0000000..5ed0139
--- /dev/null
+++ b/.idea/python-crash-course.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..a7052e2
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1741550937759
+
+
+ 1741550937759
+
+
+
+
\ No newline at end of file
diff --git a/Projects/Alien_Invasion/alien_invasion.py b/Projects/Alien_Invasion/alien_invasion.py
index 0f6b8b8..49aa77f 100644
--- a/Projects/Alien_Invasion/alien_invasion.py
+++ b/Projects/Alien_Invasion/alien_invasion.py
@@ -1,22 +1,38 @@
import sys
import pygame
+from settings import Settings
+from ship import Ship
class AlienInvasion:
"""Overall class for the game"""
def __init__(self):
"""Initialize game and create resources"""
pygame.init()
- self.screen = pygame.display.set_mode((1920, 1080))
+ self.clock = pygame.time.Clock()
+ self.settings = Settings()
+ self.screen = pygame.display.set_mode((self.settings.screen_width, self.settings.screen_height))
pygame.display.set_caption("Alien Invasion")
+ self.ship = Ship(self)
+
def run_game(self):
"""Start main game loop"""
while True:
#Listen for events
- for event in pygame.event.get():
+ self._check_events()
+ self._update_screen()
+ self.clock.tick(60)
+
+ def _check_events(self):
+ """Respond to keypresses and mouse events"""
+ for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
- # refresh display
- pygame.display.flip()
+
+ def _update_screen(self):
+ self.screen.fill(self.settings.bg_color)
+ self.ship.blitme()
+ # refresh display
+ pygame.display.flip()
if __name__ == '__main__':
# Create game instance and run game
diff --git a/Projects/Alien_Invasion/assets/shuttle.png b/Projects/Alien_Invasion/assets/shuttle.png
new file mode 100644
index 0000000..a24522d
Binary files /dev/null and b/Projects/Alien_Invasion/assets/shuttle.png differ
diff --git a/Projects/Alien_Invasion/settings.py b/Projects/Alien_Invasion/settings.py
new file mode 100644
index 0000000..20e9926
--- /dev/null
+++ b/Projects/Alien_Invasion/settings.py
@@ -0,0 +1,9 @@
+class Settings:
+ """A Class to store all settings for Alien Invasion"""
+ def __init__(self):
+ """Initialize the game's settings"""
+ # Screen settings
+ self.screen_width = 800
+ self.screen_height = 600
+ self.bg_color = (230, 230, 230)
+
\ No newline at end of file
diff --git a/Projects/Alien_Invasion/ship.py b/Projects/Alien_Invasion/ship.py
new file mode 100644
index 0000000..855ea31
--- /dev/null
+++ b/Projects/Alien_Invasion/ship.py
@@ -0,0 +1,20 @@
+import pygame
+
+class Ship():
+ """A class to manage the ship"""
+
+ def __init__(self, ai_game):
+ """Initialize the ship and set its starting position"""
+ self.screen = ai_game.screen
+ self.screen_rect = ai_game.screen.get_rect()
+
+ # Load the ship image and get its rect
+ self.image = pygame.image.load('assets/shuttle.png')
+ self.rect = self.image.get_rect()
+
+ # start each new ship at the bottom center of the screen
+ self.rect.midbottom = self.screen_rect.midbottom
+
+ def blitme(self):
+ """Draw the ship at its current location"""
+ self.screen.blit(self.image, self.rect)
\ No newline at end of file
diff --git a/bookmark.sublime-workspace b/bookmark.sublime-workspace
new file mode 100644
index 0000000..c778c82
--- /dev/null
+++ b/bookmark.sublime-workspace
@@ -0,0 +1,176 @@
+{
+ "auto_complete":
+ {
+ "selected_items":
+ [
+ ]
+ },
+ "buffers":
+ [
+ ],
+ "build_system": "",
+ "build_system_choices":
+ [
+ ],
+ "build_varint": "",
+ "command_palette":
+ {
+ "height": 0.0,
+ "last_filter": "",
+ "selected_items":
+ [
+ ],
+ "width": 0.0
+ },
+ "console":
+ {
+ "height": 0.0,
+ "history":
+ [
+ ]
+ },
+ "distraction_free":
+ {
+ "menu_visible": true,
+ "show_minimap": false,
+ "show_open_files": false,
+ "show_tabs": false,
+ "side_bar_visible": false,
+ "status_bar_visible": false
+ },
+ "file_history":
+ [
+ "/Users/cheeks/.ssh/cheeksmacmini.pub",
+ "/Users/cheeks/.ssh/vpsmacmini.pub",
+ "/Users/cheeks/.ssh/cheeksmacmini",
+ "/Users/cheeks/repos/recipe-site/_components/chicken-meatballs.md",
+ "/Users/cheeks/repos/recipe-site/about.md",
+ "/Users/cheeks/repos/python-projects/Chapter_01/README.md",
+ "/Users/cheeks/repos/python-projects/Chapter_01/fileExtensions.py",
+ "/Users/cheeks/repos/python-projects/Chapter_03/guestList.py",
+ "/Users/cheeks/repos/python-projects/Chapter_03/guestList.pt",
+ "/Users/cheeks/test.py"
+ ],
+ "find":
+ {
+ "height": 0.0
+ },
+ "find_in_files":
+ {
+ "height": 0.0,
+ "where_history":
+ [
+ ]
+ },
+ "find_state":
+ {
+ "case_sensitive": false,
+ "find_history":
+ [
+ ],
+ "highlight": true,
+ "in_selection": false,
+ "preserve_case": false,
+ "regex": false,
+ "replace_history":
+ [
+ ],
+ "reverse": false,
+ "scrollbar_highlights": true,
+ "show_context": true,
+ "use_buffer2": true,
+ "use_gitignore": true,
+ "whole_word": false,
+ "wrap": true
+ },
+ "groups":
+ [
+ {
+ "sheets":
+ [
+ ]
+ }
+ ],
+ "incremental_find":
+ {
+ "height": 0.0
+ },
+ "input":
+ {
+ "height": 0.0
+ },
+ "layout":
+ {
+ "cells":
+ [
+ [
+ 0,
+ 0,
+ 1,
+ 1
+ ]
+ ],
+ "cols":
+ [
+ 0.0,
+ 1.0
+ ],
+ "rows":
+ [
+ 0.0,
+ 1.0
+ ]
+ },
+ "menu_visible": true,
+ "output.find_results":
+ {
+ "height": 0.0
+ },
+ "pinned_build_system": "Packages/Python/Python.sublime-build",
+ "project": "bookmark.sublime-project",
+ "replace":
+ {
+ "height": 0.0
+ },
+ "save_all_on_build": true,
+ "select_file":
+ {
+ "height": 0.0,
+ "last_filter": "",
+ "selected_items":
+ [
+ ],
+ "width": 0.0
+ },
+ "select_project":
+ {
+ "height": 0.0,
+ "last_filter": "",
+ "selected_items":
+ [
+ ],
+ "width": 0.0
+ },
+ "select_symbol":
+ {
+ "height": 0.0,
+ "last_filter": "",
+ "selected_items":
+ [
+ ],
+ "width": 0.0
+ },
+ "selected_group": 0,
+ "settings":
+ {
+ },
+ "show_minimap": true,
+ "show_open_files": true,
+ "show_tabs": true,
+ "side_bar_visible": true,
+ "side_bar_width": 150.0,
+ "status_bar_visible": true,
+ "template_settings":
+ {
+ }
+}