modified the way alien rows are deleted to make them more stable
This commit is contained in:
parent
b10f67e0af
commit
6c011f11a7
19
Main.py
19
Main.py
@ -281,6 +281,18 @@ class MyGame(arcade.Window):
|
||||
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:
|
||||
@ -344,7 +356,7 @@ class MyGame(arcade.Window):
|
||||
self.alienChangeDir = 0
|
||||
# if DEBUG:
|
||||
# print(e)
|
||||
if len(self.aliens) == 0:
|
||||
if len(self.aliens) < 1 :
|
||||
self.Won = True
|
||||
# except Exception as e:
|
||||
# if DEBUG:
|
||||
@ -353,8 +365,9 @@ class MyGame(arcade.Window):
|
||||
print("You Won!")
|
||||
sys.exit()
|
||||
# Check to see if any aliens are colliding with a player's bullet
|
||||
for alienRow in self.aliens:
|
||||
if alienRow == []:
|
||||
for index, alienRow in enumerate(self.aliens):
|
||||
length = len(self.aliens)
|
||||
if alienRow == [] and index == length - 1 and length > 0:
|
||||
self.aliens.remove(alienRow)
|
||||
for alien in alienRow:
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user