Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit 0d0a7e901dd72423f06a6c1bb8e7e8738d1572b9 1 parent e244274
Al Sweigart authored
Showing with 5 additions and 8 deletions.
  1. +5 −8 square-shooter/square-shooter_makeover.py
13 square-shooter/square-shooter_makeover.py
View
@@ -26,13 +26,12 @@
import random
import pygame
-BLACK = (0, 0, 0)
-GREEN = (0, 204, 0)
-RED = (255, 0, 0)
+BLACK = ( 0, 0, 0)
+GREEN = ( 0, 204, 0)
+RED = (255, 0, 0)
SILVER = (204, 204, 204)
-WHITE = (255, 255, 255)
+WHITE = (255, 255, 255)
-powerup_types = ["shield", "bullet", "freeze"]
def scale_and_round(x, y):
x = int(round(x * 480))
@@ -135,8 +134,6 @@ class GameWorld:
high_score = 0
lives = 0
- powerup_types = ["shield", "bullet", "freeze"]
-
def init_level(self, level):
self.level = level
if (level > self.max_level): self.max_level = level
@@ -274,7 +271,7 @@ def spawn_explosion(self, bubble):
def spawn_powerup(self, bubble):
powerup = Bubble2D(0.03)
powerup.position.copy(bubble.position)
- powerup.kind = random.choice(powerup_types)
+ powerup.kind = random.choice(("shield", "bullet", "freeze"))
powerup.age = 0
self.powerups.append(powerup)

1 comment on commit 0d0a7e9

Patrick O'Leary

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.