diff --git a/.idea/CNSA-266-FP.iml b/.idea/CNSA-266-FP.iml index bf0924d..673a12b 100644 --- a/.idea/CNSA-266-FP.iml +++ b/.idea/CNSA-266-FP.iml @@ -5,7 +5,7 @@ - + \ No newline at end of file diff --git a/Main.py b/Main.py index f84f6ca..c9fdd2a 100644 --- a/Main.py +++ b/Main.py @@ -21,7 +21,7 @@ SCREEN_TITLE = "Space Invaders" PLAYER_SPEED = 1 PLAYER_BOUNDS = 32 -ALIEN_BOUNDS = 16 +ALIEN_BOUNDS = 32 @@ -56,6 +56,7 @@ class MyGame(arcade.Window): self.current_texture_index = 0 self.player_sprite = None + self.level = 0 self.movePlayer = 0 if DEBUG: @@ -82,7 +83,6 @@ class MyGame(arcade.Window): self.player_list = arcade.SpriteList() self.wall_list = arcade.SpriteList(use_spatial_hash=True) self.rend = 0 - self.level = 0 self.score = None # self.overlay_color = (0,255,0,128) self.player_sprite_death = None @@ -96,6 +96,7 @@ class MyGame(arcade.Window): self.player_sprite.center_y = (32 + 4) * SCREEN_SCALE self.player_list.append(self.player_sprite) + self.level += 1 # Create Left Boundry if DEBUG == True: @@ -236,17 +237,28 @@ class MyGame(arcade.Window): self.respawn() else: if DEBUG: - print(str(self.Score)) + print("\n" * 100) + print("You scored: " + str(self.Score)) + print("You died on level: " + str(self.level)) sys.exit() def update(self, delta_time): + if True: # Picking numbers to possibly spawn an alien bullet - testx = random.randint(0, 5 + 100 - self.level) - testy = random.randint(0, 11 + 100 - self.level) + testx = random.randint(0, 5 + 100 - self.level * 5) + testy = random.randint(0, 11 + 100 - self.level * 5) + testx = 500 + testy = 500 + + if self.alienCounterY < 0: + # Reset the X and Y counter variables + self.alienCounterY = len(self.aliens) - 1 + + self.alienCounterX = 0 # Checking if player bullet is off-screen, if so, set bullet to None, else, update bullet try: @@ -264,6 +276,9 @@ class MyGame(arcade.Window): for alienx in self.aliens: for alien in alienx: try: + if alien.getY() - 8 * SCREEN_SCALE < self.player_sprite.center_y: + self.lives = 0 + self.death() alien.bullet.update() except Exception as e: pass @@ -284,22 +299,6 @@ class MyGame(arcade.Window): except Exception as e: pass - if self.alienCounterY < 0: - # Reset the X and Y counter variables - self.alienCounterY = len(self.aliens) - 1 - if self.alienCounterY < 0: - # Reset the X and Y counter variables - self.alienCounterY = len(self.aliens) - 1 - if self.alienCounterY < 0: - # Reset the X and Y counter variables - self.alienCounterY = len(self.aliens) - 1 - if self.alienCounterY < 0: - # Reset the X and Y counter variables - self.alienCounterY = len(self.aliens) - 1 - if self.alienCounterY < 0: - # Reset the X and Y counter variables - self.alienCounterY = len(self.aliens) - 1 - self.alienCounterX = 0 # Alien Movement if self.Won == False: #Left - Right Movement