diff options
Diffstat (limited to 'dev/pacmath.activity/basicMovement.py')
-rw-r--r-- | dev/pacmath.activity/basicMovement.py | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/dev/pacmath.activity/basicMovement.py b/dev/pacmath.activity/basicMovement.py index 404ce9e..43f0ec4 100644 --- a/dev/pacmath.activity/basicMovement.py +++ b/dev/pacmath.activity/basicMovement.py @@ -1,17 +1,43 @@ +""" +@license: U{http://creativecommons.org/licenses/by-sa/3.0/us/} +""" import pygame import sys from mazeSetup import mazeSetup class basicMovement(pygame.sprite.Sprite): - def __init__(self, position): + def __init__(self): + """ + Constructs a new basicMovement object + """ pygame.sprite.Sprite.__init__(self) self.moving = False def getMoving(self): + """ + Accessor for moving + @rtype: boolean + @return: moving + """ #for moving until the character reaches an intersection return self.moving - def update(self, screen, character, amount, MAZE_SIZE, mazeObj): + def update(self, screen, character, amount, MAZE_SIZE, mazeObj): + """ + Moves a character a given amount, handling wall collision detection + @type screen: pygame.display + @param screen: the screen in which we will draw + @type character: usually self, referring to a GhostMovement or pacmanMovement + @param character: the character on which the movement is performed + @type amount: [dx, dy] + @param amount: the amount to move in each direction + @param MAZE_SIZE: size of maze + @type mazeObj: Maze + @param mazeObj: an instance of the maze + @rtype: int + @return: 0 for no pacman event, 1 for small pellet eaten, 2 for power pellet eaten + """ + pacmanEvent = 0 # Make a copy of the current rectangle for use in erasing |