Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Kitson <msk5293@rit.edu>2010-11-08 01:10:35 (GMT)
committer Michael Kitson <msk5293@rit.edu>2010-11-08 01:10:35 (GMT)
commitc6402cc304e86d5bce8340e805432c3e0860c6a5 (patch)
tree4ec13f989b6366e7066f11feb3a331c3452779b1
parente82ad34fca5d028d7bdad6e80e2ca10c646c9ae8 (diff)
Sprites should no longer be able to pass one another in opposite directions, switching locations, without triggering a collision.
-rw-r--r--dev/pacmath.activity/gameMain.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/dev/pacmath.activity/gameMain.py b/dev/pacmath.activity/gameMain.py
index f7e0fa1..7d890cb 100644
--- a/dev/pacmath.activity/gameMain.py
+++ b/dev/pacmath.activity/gameMain.py
@@ -68,15 +68,17 @@ class gameMain:
@param event: directional key
@param frame: frame where game is held
"""
+ alreadyCollided = False
# anything the needs to be update in the game loop
# such as the players, screen.blit, etc.
ghostMovement.update(self.ghost1, self.screen, MAZE_SIZE, self.maze)
ghostMovement.update(self.ghost2, self.screen, MAZE_SIZE, self.maze)
ghostMovement.update(self.ghost3, self.screen, MAZE_SIZE, self.maze)
ghostMovement.update(self.ghost4, self.screen, MAZE_SIZE, self.maze)
+ alreadyCollided = self.checkCollisions()
pacmanMovement.update(self.pacman, self.screen, event, MAZE_SIZE, self.maze)
-
- self.checkCollisions()
+ if not alreadyCollided:
+ self.checkCollisions()
pygame.display.update()
@@ -85,6 +87,7 @@ class gameMain:
self.score += 100
self.resetQuestion()
self.QandA.updateScore(self.screen, self.score)
+ return True
for ghost in pygame.sprite.spritecollide(self.pacman, self.wrongGhosts, False):
self.score -= 50
@@ -94,6 +97,8 @@ class gameMain:
else:
self.QandA.updateLives(self.screen, self.lives)
self.QandA.updateScore(self.screen, self.score)
+ return True
+ return False
def pause(self):
"""