Cleanup the avocado generation

master
Raphaël Vinot 2014-08-31 01:52:54 +02:00
parent f98940e307
commit 8deb08d9b1
2 changed files with 2 additions and 10 deletions

View File

@ -7,15 +7,6 @@ class Avocado:
def __init__(self, screen, color, size, target, filename='img/AvoCado_0.png'):
# HELP please!!
# We randomly decide whether we should instanciate or not
# I'd rather just not return an instance,
# but I don't know how to do that :(
if random.randint(0,40) != 1:
self.is_still_falling = False
self.has_been_pinned = False
return None
# Set up our instance variables
self.screen = screen
self.color = color

View File

@ -168,7 +168,8 @@ class TheGame:
avocados_in_game = len(avocados)
avocadosWanted = level * multiplier
if avocados_in_game < avocadosWanted:
for i in range(avocados_in_game, avocadosWanted):
blah = int(1.0/(avocadosWanted - avocados_in_game) * 100)
if random.randint(0, blah) == 1:
avocolor = self.chooseRandomColor()
avosize = (50, 50) # should we randomize this?
a = avocado.Avocado(self.screen, avocolor, avosize, color)