From ffa990eae1392fabf237a8c58ccaee9da8568a53 Mon Sep 17 00:00:00 2001
From: cheeks <134818917+leftovertoast@users.noreply.github.com>
Date: Mon, 10 Mar 2025 10:41:29 -0400
Subject: [PATCH] Alien Invastion progress
---
.../inspectionProfiles/profiles_settings.xml | 6 +
.idea/misc.xml | 4 +
.idea/modules.xml | 8 +
.idea/python-crash-course.iml | 12 ++
.idea/vcs.xml | 6 +
.idea/workspace.xml | 47 +++++
Projects/Alien_Invasion/alien_invasion.py | 24 ++-
Projects/Alien_Invasion/assets/shuttle.png | Bin 0 -> 767 bytes
Projects/Alien_Invasion/settings.py | 9 +
Projects/Alien_Invasion/ship.py | 20 ++
bookmark.sublime-workspace | 176 ++++++++++++++++++
11 files changed, 308 insertions(+), 4 deletions(-)
create mode 100644 .idea/inspectionProfiles/profiles_settings.xml
create mode 100644 .idea/misc.xml
create mode 100644 .idea/modules.xml
create mode 100644 .idea/python-crash-course.iml
create mode 100644 .idea/vcs.xml
create mode 100644 .idea/workspace.xml
create mode 100644 Projects/Alien_Invasion/assets/shuttle.png
create mode 100644 Projects/Alien_Invasion/settings.py
create mode 100644 Projects/Alien_Invasion/ship.py
create mode 100644 bookmark.sublime-workspace
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 0000000000000000000000000000000000000000..a24522da23832c439bdfd238b873148881e00423
GIT binary patch
literal 767
zcmVe
zSad^gZEa<4bO1wgWnpw>WFU8GbZ8()Nlj2!fese{00L)8L_t(&-tAg3uA4v*eIVM@
zDNzI#U9Mm$xy3J|R8UxMa)>ktOL3VqM2evMk$i|02vFpcOp18;UgE`zy~78KkyeOh
zy*tm3c{95KgV}SW_y7>v_kzd^fN=VtrYqg>Vlo3C=d}TLXf8E#ep0{e6=YK)|5+;&ZpWdhy!qa;Is881yOP^-|XuI8Bm2U2r5C+j0x|WA#qjKl@Mpr4!Qsw5t
z5NX=I4E4?{1&D|UM1-oU+7`z#*6a1n4Eer~EX$NRdETL*yj$aho#|H3U4}00hx$}b
zH}4Wdi^@F!L&SkUCPTjO4-y6wKm>rQs(LksvMhtCjJqa4s;V+xTq=gxk88j@4G{kD
z;P;$&tbGjKa+Jkm*{{`VMVF2dJX=6)<)M3lx!nq&EX%vpXDpRtKRd4?Tn3ZpIr2Q8
zT^?d!EF6!Shq{OAOQo>XatlKXLkmL-LnATdoi8TAkgZzI)ISe^b5`K>n#l%FqT1eU
zHm2XF<6SDjb#^!$C`l3#hIB>o@pv@$Z_vQ*HbZl0r-15X==}NVCrK+l-XaQ)rroP@
xz4MA5H0o@(+Zm5#Ft(-J_FrRYB7QuM{RM=vdnGv78}|SJ002ovPDHLkV1j@bPOAU_
literal 0
HcmV?d00001
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":
+ {
+ }
+}