Merge branch 'master' of github.com:lvl2/avocados
commit
16018b5c97
|
@ -10,7 +10,7 @@ class Avocado:
|
|||
# Set up our instance variables
|
||||
self.screen = screen
|
||||
self.screen_width, self.screen_height = screen.get_size()
|
||||
color = properties['color']
|
||||
self.color = properties['color']
|
||||
self.w, self.y = properties['size']
|
||||
self.target = target
|
||||
self.boundaries = boundaries
|
||||
|
@ -18,7 +18,7 @@ class Avocado:
|
|||
|
||||
# Initialize the image
|
||||
self.i = pygame.image.load(filename).convert_alpha()
|
||||
operations.color_surface(self.i, color)
|
||||
operations.color_surface(self.i, self.color)
|
||||
self.image = pygame.transform.scale(self.i, (self.w, self.y))
|
||||
self.rect = self.image.get_rect()
|
||||
|
||||
|
|
10
game.py
10
game.py
|
@ -36,6 +36,7 @@ class TheGame:
|
|||
self.bg = pygame.image.load(os.path.join('img', 'lawyerCrystalBall.png'))
|
||||
self.bg.set_colorkey((255,255,255))
|
||||
self.bg.set_alpha(75)
|
||||
self.last_colors = []
|
||||
|
||||
# fonts
|
||||
self.bigFont = pygame.font.Font(None, 90)
|
||||
|
@ -101,9 +102,16 @@ class TheGame:
|
|||
|
||||
def chooseRandomColor(self):
|
||||
selected = random.randint(0, 3)
|
||||
if len(self.last_colors) > 5:
|
||||
self.last_colors.pop(0)
|
||||
for i in range(0, 5):
|
||||
if selected in self.last_colors:
|
||||
selected = random.randint(0, 3)
|
||||
else:
|
||||
break
|
||||
self.last_colors.append(selected)
|
||||
return self.colors[selected]
|
||||
|
||||
|
||||
def gameOver(self):
|
||||
screen_width, screen_height = self.screen.get_size()
|
||||
gameOverImage = pygame.image.load("img/gameOver.png")
|
||||
|
|
Loading…
Reference in New Issue