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