From 743d0994dfed44d5f991eced28767baa3ebf3a29 Mon Sep 17 00:00:00 2001 From: David Raison Date: Sun, 31 Aug 2014 12:08:00 +0200 Subject: [PATCH 1/2] All is well ;) --- avocado.py | 6 +++++- crystal.py | 8 +++++--- game.py | 1 + 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/avocado.py b/avocado.py index bc34929..5f3858d 100644 --- a/avocado.py +++ b/avocado.py @@ -98,11 +98,15 @@ 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)): - self.vx = -self.vx + if self.rect.bottom > top: + self.vx = -self.vx def move(self): diff --git a/crystal.py b/crystal.py index acb792f..a404bf4 100644 --- a/crystal.py +++ b/crystal.py @@ -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): diff --git a/game.py b/game.py index 8374131..5b9eeef 100755 --- a/game.py +++ b/game.py @@ -98,6 +98,7 @@ class TheGame: return pygame.mixer.music.fadeout(3000) + def chooseRandomColor(self): selected = random.randint(0, 3) return self.colors[selected] From 1fa7f9048b9515d53f89d1d087d683c37a238cc7 Mon Sep 17 00:00:00 2001 From: David Raison Date: Sun, 31 Aug 2014 12:09:07 +0200 Subject: [PATCH 2/2] Removed rectangle --- crystal.py | 1 - 1 file changed, 1 deletion(-) diff --git a/crystal.py b/crystal.py index a404bf4..2b36588 100644 --- a/crystal.py +++ b/crystal.py @@ -24,7 +24,6 @@ class Crystal: 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):