Merge branch 'master' of github.com:lvl2/avocados
commit
806aacd59a
|
@ -11,7 +11,7 @@ class Avocado:
|
||||||
# We randomly decide whether we should instanciate or not
|
# We randomly decide whether we should instanciate or not
|
||||||
# I'd rather just not return an instance,
|
# I'd rather just not return an instance,
|
||||||
# but I don't know how to do that :(
|
# but I don't know how to do that :(
|
||||||
if random.randint(0,1) == 0:
|
if random.randint(0,40) != 1:
|
||||||
self.is_falling = False
|
self.is_falling = False
|
||||||
self.has_been_pinned = False
|
self.has_been_pinned = False
|
||||||
return None
|
return None
|
||||||
|
@ -31,8 +31,9 @@ class Avocado:
|
||||||
|
|
||||||
# Set the avocado's initial position and velocity
|
# Set the avocado's initial position and velocity
|
||||||
self.init_pos()
|
self.init_pos()
|
||||||
self.vx = 10
|
self.vx = 2
|
||||||
self.vy = 10
|
self.vy = 4
|
||||||
|
|
||||||
self.is_falling = True
|
self.is_falling = True
|
||||||
self.has_been_pinned = False
|
self.has_been_pinned = False
|
||||||
|
|
||||||
|
|
5
game.py
5
game.py
|
@ -70,6 +70,7 @@ class TheGame:
|
||||||
self.click = pygame.mixer.Sound("audio/click.wav")
|
self.click = pygame.mixer.Sound("audio/click.wav")
|
||||||
return self.click
|
return self.click
|
||||||
|
|
||||||
|
|
||||||
def gameOver(self,screen,gameOverImage):
|
def gameOver(self,screen,gameOverImage):
|
||||||
screen.blit(pygame.transform.scale(gameOverImage, (800, 600)), (0, 0))
|
screen.blit(pygame.transform.scale(gameOverImage, (800, 600)), (0, 0))
|
||||||
pygame.display.flip()
|
pygame.display.flip()
|
||||||
|
@ -83,7 +84,7 @@ class TheGame:
|
||||||
clock = pygame.time.Clock()
|
clock = pygame.time.Clock()
|
||||||
size = (800, 600)
|
size = (800, 600)
|
||||||
bg = pygame.image.load("img/background.png")
|
bg = pygame.image.load("img/background.png")
|
||||||
desired_fps = 15
|
desired_fps = 60
|
||||||
multiplier = 3
|
multiplier = 3
|
||||||
score = 0
|
score = 0
|
||||||
time = timeleft = 30
|
time = timeleft = 30
|
||||||
|
@ -95,7 +96,6 @@ class TheGame:
|
||||||
|
|
||||||
# I don't know, should we move this text out of the way?
|
# I don't know, should we move this text out of the way?
|
||||||
game_over = font.render('GAME OVER', 0, RED)
|
game_over = font.render('GAME OVER', 0, RED)
|
||||||
|
|
||||||
gameOverImage = pygame.image.load("img/gameOver.png")
|
gameOverImage = pygame.image.load("img/gameOver.png")
|
||||||
|
|
||||||
# initialize the game canvas
|
# initialize the game canvas
|
||||||
|
@ -177,7 +177,6 @@ class TheGame:
|
||||||
for a in self.pinned:
|
for a in self.pinned:
|
||||||
a.blitme()
|
a.blitme()
|
||||||
|
|
||||||
|
|
||||||
# Catch events
|
# Catch events
|
||||||
for event in pygame.event.get():
|
for event in pygame.event.get():
|
||||||
# Collision detection
|
# Collision detection
|
||||||
|
|
Loading…
Reference in New Issue