Cleanup the avocado generation
parent
f98940e307
commit
8deb08d9b1
|
@ -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
|
||||
|
|
3
game.py
3
game.py
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue