All is well ;)

master
David Raison 2014-08-31 12:08:00 +02:00
parent b9e10650be
commit 743d0994df
3 changed files with 11 additions and 4 deletions

View File

@ -98,10 +98,14 @@ class Avocado:
if self.checkObstacle \
and (self.rect.right < right and self.rect.left > left):
self.checkObstacle = False
# print(self.rect.bottom, top)
# if self.rect.bottom > top:
# self.vy = -self.vy
if self.checkObstacle \
and ((self.rect.right > right and self.rect.left < right) \
or (self.rect.left < left and self.rect.right > left)):
if self.rect.bottom > top:
self.vx = -self.vx

View File

@ -12,17 +12,19 @@ class Crystal:
def __init__(self, screen):
self.screen = screen
screen_width, screen_height = screen.get_size()
self.rect = self.screen.get_rect()
self.imageCenterX = self.rect.centerx
self.imageCenterY = self.rect.centery
screen_rect = self.screen.get_rect()
self.imageCenterX = screen_rect.centerx
self.imageCenterY = screen_rect.centery
self.pos = (self.imageCenterX-100,self.imageCenterY-5,200,183)
def getBoundaries(self):
return self.pos
def blitme(self):
pygame.draw.ellipse(self.screen, self.color, self.pos, 0)
pygame.draw.rect(self.screen, WHITE, self.pos, 2)
def setColor(self, color):

View File

@ -98,6 +98,7 @@ class TheGame:
return
pygame.mixer.music.fadeout(3000)
def chooseRandomColor(self):
selected = random.randint(0, 3)
return self.colors[selected]