Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Simplifying init_level() code.

  • Loading branch information...
commit ed966a15f7a4a922321d029786a85beb40160554 1 parent 17b99c9
@asweigart authored
Showing with 5 additions and 6 deletions.
  1. +5 −6 square-shooter/square-shooter_makeover.py
View
11 square-shooter/square-shooter_makeover.py
@@ -273,6 +273,7 @@ class GameWorld:
high_score = 0
lives = 0
+
def init_level(self, level):
self.level = level
@@ -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)

0 comments on commit ed966a1

Please sign in to comment.
Something went wrong with that request. Please try again.