diff options
author | Michael Kitson <msk5293@rit.edu> | 2010-11-09 20:30:34 (GMT) |
---|---|---|
committer | Michael Kitson <msk5293@rit.edu> | 2010-11-09 20:30:34 (GMT) |
commit | 32f05ef0e8d9f385db873318c6b6d51e96eaebe2 (patch) | |
tree | b409407d9c4ede43915879aca10c472e3a2cb257 | |
parent | 05cbb436585a732e145f7124904080be15449dd1 (diff) |
Added comments to maze and mazeSetup
-rw-r--r-- | dev/pacmath.activity/maze.py | 7 | ||||
-rw-r--r-- | dev/pacmath.activity/mazeSetup.py | 30 |
2 files changed, 15 insertions, 22 deletions
diff --git a/dev/pacmath.activity/maze.py b/dev/pacmath.activity/maze.py index c9b434a..e16c7a3 100644 --- a/dev/pacmath.activity/maze.py +++ b/dev/pacmath.activity/maze.py @@ -103,6 +103,13 @@ class Maze: return grid def getPoint(self, x, y): + """ + Used by mazeSetup.py to get the type of block at a given set of + coordinates, returns solid if it is off the grid + @param x: the X parameter, may be off the grid + @param y: the Y parameter, may be off the grid + @return the integer representing block type, use the class constants to determine what that means. + """ if x < 0 or y < 0 or x >= self.width or y >= self.height: return self.SOLID else: diff --git a/dev/pacmath.activity/mazeSetup.py b/dev/pacmath.activity/mazeSetup.py index d015290..a6f64f8 100644 --- a/dev/pacmath.activity/mazeSetup.py +++ b/dev/pacmath.activity/mazeSetup.py @@ -1,19 +1,19 @@ #! /usr/bin/env python """Setup the maze so it could be drawn in the screen @license: U{http://creativecommons.org/licenses/by-sa/3.0/us/} +@var FILLED: whether or nott the filled wall images are used """ -#import olpcgames, pygame, logging -#from olpcgames import pausescreen + import pygame from maze import Maze -#log = logging.getLogger( 'pacmath run' ) -#log.setLevel( logging.DEBUG ) -FILLED = True +FILLED = True # Determines the set of maze wall images used, filled or unfilled class mazeSetup: - +""" +Interprets the maze object made in maze.py, draws it all on the screen +""" def __init__ (self, screen, MAZE_SIZE): """ Initialize the maze setup @@ -32,20 +32,6 @@ class mazeSetup: #call the draw function self.drawMaze(screen, MAZE_SIZE) - #Make Space for the question - #background = pygame.Surface((size[0], size[1])) - #background = background.convert() - #background.fill((255, 255, 255)) - #Make text - #pygame.font.init() - #font = pygame.font.Font(None, 72) - - #text = font.render("2 + 2 = ?", 1, (255, 165, 0) ) - #textpos = text.get_rect(size[1]) - #background.blit(text, textpos) - #self.screen.blit(background, (0 ,size[1]-yperc)) - - def drawPoint(self, screen, x, y): """ Draw a certain point of the maze on the screen @@ -155,13 +141,13 @@ class mazeSetup: else: print "MAZE FAIL" - if FILLED == True: + if FILLED == True: # uses the filled image blocks instead if file == 'EMPTY': file = './images/25_box' file += '_filled' - if not file == 'EMPTY': + if not file == 'EMPTY': # empty is treated as 'use a black box' return pygame.image.load(file+'.png').convert_alpha() else: return False |