Skip to content

Commit

Permalink
Simplifying init_level() code.
Browse files Browse the repository at this point in the history
  • Loading branch information
asweigart committed Aug 8, 2012
1 parent 17b99c9 commit ed966a1
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions square-shooter/square-shooter_makeover.py
Expand Up @@ -273,6 +273,7 @@ class GameWorld:
high_score = 0
lives = 0


def init_level(self, level):
self.level = level

Expand All @@ -288,14 +289,12 @@ def init_level(self, level):
self.afterdeath_timer = 0
self.afterfinish_timer = 0

# clear out the bubbles, explosions, and power ups from the last level.
del self.bubbles[:]
del self.explosions[:]
del self.powerups[:]
# clear out the explosions, and power ups from the last level.
self.explosions = []
self.powerups = []

# create a number of starting big bubbles as the level number.
for i in range(level):
self.bubbles.append(Bubble("big"))
self.bubbles = [Bubble("big") for i in range(level)]

def update(self, delta_t):
self.handle_collisions(delta_t)
Expand Down

0 comments on commit ed966a1

Please sign in to comment.