Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Aligned the color constants and got rid of the powerup_types variable.

  • Loading branch information...
commit 0d0a7e901dd72423f06a6c1bb8e7e8738d1572b9 1 parent e244274
Al Sweigart authored August 07, 2012
13  square-shooter/square-shooter_makeover.py
@@ -26,13 +26,12 @@
26 26
 import random
27 27
 import pygame
28 28
 
29  
-BLACK = (0, 0, 0)
30  
-GREEN = (0, 204, 0)
31  
-RED = (255, 0, 0)
  29
+BLACK  = (  0,   0,   0)
  30
+GREEN  = (  0, 204,   0)
  31
+RED    = (255,   0,   0)
32 32
 SILVER = (204, 204, 204)
33  
-WHITE = (255, 255, 255)
  33
+WHITE  = (255, 255, 255)
34 34
 
35  
-powerup_types = ["shield", "bullet", "freeze"]
36 35
 
37 36
 def scale_and_round(x, y):
38 37
 	x = int(round(x * 480))
@@ -135,8 +134,6 @@ class GameWorld:
135 134
 	high_score = 0
136 135
 	lives = 0
137 136
 
138  
-	powerup_types = ["shield", "bullet", "freeze"]
139  
-
140 137
 	def init_level(self, level):
141 138
 		self.level = level
142 139
 		if (level > self.max_level): self.max_level = level
@@ -274,7 +271,7 @@ def spawn_explosion(self, bubble):
274 271
 	def spawn_powerup(self, bubble):
275 272
 		powerup = Bubble2D(0.03)
276 273
 		powerup.position.copy(bubble.position)
277  
-		powerup.kind = random.choice(powerup_types)
  274
+		powerup.kind = random.choice(("shield", "bullet", "freeze"))
278 275
 		powerup.age = 0
279 276
 		self.powerups.append(powerup)
280 277
 

1 note on commit 0d0a7e9

Patrick O'Leary
pao commented on 0d0a7e9 August 10, 2012

Be aware that if you needed to strictly follow PEP8, the diff on lines 29-33 would be improper.

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