resolved merge conflict
commit
12f3e083c6
|
@ -47,12 +47,13 @@ class Avocado:
|
|||
Checks whether this object collides with the given position
|
||||
in click
|
||||
"""
|
||||
#if collision and …
|
||||
if self.color == self.select:
|
||||
mousex, mousey = click
|
||||
if self.pycard.left < mousex and self.pycard.right > mousex and \
|
||||
self.pycard.top < mousey and self.pycard.bottom > mousey and \
|
||||
self.color == self.select:
|
||||
self.destroy()
|
||||
return True
|
||||
|
||||
|
||||
def destroy(self):
|
||||
"""destroys this object"""
|
||||
del(self)
|
||||
|
|
5
game.py
5
game.py
|
@ -66,10 +66,13 @@ def main():
|
|||
timeleft -= time_passed / 1000
|
||||
timeleft = round(timeleft, 2)
|
||||
|
||||
|
||||
if timeleft <= 0:
|
||||
screen_width, screen_height = size
|
||||
screen.blit(game_over, (screen_width/3, screen_height/2))
|
||||
displaytime = 'Timed out!'
|
||||
pygame.display.flip()
|
||||
continue
|
||||
else:
|
||||
displaytime = timeleft
|
||||
|
||||
|
@ -98,7 +101,7 @@ def main():
|
|||
for avo in avocados:
|
||||
if avo.collides(pygame.mouse.get_pos()):
|
||||
score += 100
|
||||
|
||||
avo.init_pos()
|
||||
# Had enough of this?
|
||||
if event.type == pygame.QUIT:
|
||||
running = False
|
||||
|
|
Loading…
Reference in New Issue