Fixed merge conflict
commit
bfa10307db
|
@ -7,6 +7,7 @@ class Avocado:
|
||||||
|
|
||||||
def __init__(self, screen, color, filename='img/AvoCado_0.png'):
|
def __init__(self, screen, color, filename='img/AvoCado_0.png'):
|
||||||
print('New avocado is ' + ','.join(str(color)))
|
print('New avocado is ' + ','.join(str(color)))
|
||||||
|
self.screen = screen
|
||||||
self.screen_width, self.screen_height = screen.get_size()
|
self.screen_width, self.screen_height = screen.get_size()
|
||||||
self.x = random.randint(0, self.screen_width)
|
self.x = random.randint(0, self.screen_width)
|
||||||
self.y = 0 # change this to start somewhere above the screen
|
self.y = 0 # change this to start somewhere above the screen
|
||||||
|
@ -16,15 +17,14 @@ class Avocado:
|
||||||
self.image = pygame.transform.scale(self.i, (30, 30))
|
self.image = pygame.transform.scale(self.i, (30, 30))
|
||||||
self.pycard = self.image.get_rect()
|
self.pycard = self.image.get_rect()
|
||||||
|
|
||||||
self.pycard.x = random.randint(0, self.screen_width)
|
self.init_pos()
|
||||||
self.pycard.y = random.randint(20, 70)
|
|
||||||
self.step_x = 10
|
self.step_x = 10
|
||||||
self.step_y = 10
|
self.step_y = 10
|
||||||
self.is_falling = True
|
self.is_falling = True
|
||||||
|
|
||||||
def reset(self):
|
def init_pos(self):
|
||||||
self.pycard.x = random.randint(0, self.screen_width)
|
self.pycard.x = random.randint(0, self.screen_width)
|
||||||
self.pycard.y = random.randint(0, 50)
|
self.pycard.y = random.randint(20, 70)
|
||||||
|
|
||||||
def collides(self, click):
|
def collides(self, click):
|
||||||
"""
|
"""
|
||||||
|
|
3
game.py
3
game.py
|
@ -40,6 +40,7 @@ def main():
|
||||||
# initialize the HUD class and the lawyer
|
# initialize the HUD class and the lawyer
|
||||||
the_hud = hud.Hud(screen)
|
the_hud = hud.Hud(screen)
|
||||||
fullegast = lawyer.Lawyer(screen)
|
fullegast = lawyer.Lawyer(screen)
|
||||||
|
|
||||||
# Well, we want this to select between several colors, so we need a list
|
# Well, we want this to select between several colors, so we need a list
|
||||||
# of colors, right?
|
# of colors, right?
|
||||||
colors = [BLUE, GREEN, RED, YELLOW]
|
colors = [BLUE, GREEN, RED, YELLOW]
|
||||||
|
@ -85,7 +86,7 @@ def main():
|
||||||
|
|
||||||
for a in avocados:
|
for a in avocados:
|
||||||
if not a.move():
|
if not a.move():
|
||||||
a.reset()
|
a.init_pos()
|
||||||
screen.blit(a.image, a.pycard)
|
screen.blit(a.image, a.pycard)
|
||||||
|
|
||||||
# Catch events
|
# Catch events
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
Binary file not shown.
After Width: | Height: | Size: 508 KiB |
Loading…
Reference in New Issue