diff options
author | Abel Rendon Jr <abel.rendonjr@gmail.com> | 2010-02-25 22:09:55 (GMT) |
---|---|---|
committer | Abel Rendon Jr <abel.rendonjr@gmail.com> | 2010-02-25 22:09:55 (GMT) |
commit | 31eb1957dbc55fba836fca7883c12b8df039de14 (patch) | |
tree | e153cf35aa6fbb9cb951b31e17d27a75274aaf73 | |
parent | 36086a08ecc97db2ecd3882dbf41c4d9038f6397 (diff) |
Epydoc
-rw-r--r-- | dev/pacmath.activity/GhostMovement.py | 20 | ||||
-rw-r--r-- | dev/pacmath.activity/GhostMovement.pyc | bin | 2749 -> 2911 bytes | |||
-rw-r--r-- | dev/pacmath.activity/gameMain.py | 18 | ||||
-rw-r--r-- | dev/pacmath.activity/pacmanMovement.py | 17 | ||||
-rw-r--r-- | dev/pacmath.activity/pacmanMovement.pyc | bin | 3168 -> 3532 bytes | |||
-rw-r--r-- | dev/pacmath.activity/question.py | 30 | ||||
-rw-r--r-- | dev/pacmath.activity/question.pyc | bin | 2833 -> 3906 bytes |
7 files changed, 82 insertions, 3 deletions
diff --git a/dev/pacmath.activity/GhostMovement.py b/dev/pacmath.activity/GhostMovement.py index bbd7010..32712b4 100644 --- a/dev/pacmath.activity/GhostMovement.py +++ b/dev/pacmath.activity/GhostMovement.py @@ -1,3 +1,9 @@ +#! /usr/bin/env python +""" +Creationg of enemy sprites and movement +@license: U{http://creativecommons.org/licenses/by-sa/3.0/us/} +""" + from basicMovement import basicMovement import pygame import sys @@ -5,6 +11,10 @@ import random class ghostMovement(pygame.sprite.Sprite): def __init__(self, position, g, q): + """ + Creates a Enemy sprite + @param position: location of enemy in maze + """ pygame.sprite.Sprite.__init__(self) self.name = 'Ghost' self.question = q @@ -35,6 +45,10 @@ class ghostMovement(pygame.sprite.Sprite): self.rect.y = 300 def randomMovement(self): + """ + Randomly generates the movement of the enemy + @return: returns the amount to move by + """ on = 1 #0 is off and 1 is on #dx and dy are delta x and y for the change in x and y position dx = 0 @@ -74,6 +88,12 @@ class ghostMovement(pygame.sprite.Sprite): return amount def update(self, screen, MAZE_SIZE, mazeObj): + """ + Updates enemy sprite using random movement + @param screen: the screen in which we will draw + @param MAZE_SIZE: size of maze + @param mazeObj: an instance of the maze + """ # call basic movement and add any other update amount = self.randomMovement() self.move.update(screen, self, amount, MAZE_SIZE, mazeObj) diff --git a/dev/pacmath.activity/GhostMovement.pyc b/dev/pacmath.activity/GhostMovement.pyc Binary files differindex 78b2d23..b1e239f 100644 --- a/dev/pacmath.activity/GhostMovement.pyc +++ b/dev/pacmath.activity/GhostMovement.pyc diff --git a/dev/pacmath.activity/gameMain.py b/dev/pacmath.activity/gameMain.py index 7f734ad..3a19b8e 100644 --- a/dev/pacmath.activity/gameMain.py +++ b/dev/pacmath.activity/gameMain.py @@ -1,4 +1,12 @@ -from GhostMovement import ghostMovement +#! /usr/bin/env python +""" +Creates a game with maze and sprites and updates game +@license: U{http://creativecommons.org/licenses/by-sa/3.0/us/} +@var done: when game is done it will equal true +@var MAZE_SIZE: size of maze +@var MAZE_DRAW_FRAME: size of maze to be drawn +""" + from pacmanMovement import pacmanMovement from mazeSetup import mazeSetup from question import question @@ -12,10 +20,18 @@ MAZE_DRAW_FRAME = 25 class gameMain: def __init__(self): + """ + Constructor + """ # everything for setting up the game temp = 0 def update(self, event, frame): + """ + Updates the maze and sprites given an event + @param event: directional key + @param frame: frame where game is held + """ # anything the needs to be update in the game loop # such as the players, screen.blit, etc. ghostMovement.update(ghost1, screen, MAZE_SIZE, maze) diff --git a/dev/pacmath.activity/pacmanMovement.py b/dev/pacmath.activity/pacmanMovement.py index 4d8f6c1..e9ee582 100644 --- a/dev/pacmath.activity/pacmanMovement.py +++ b/dev/pacmath.activity/pacmanMovement.py @@ -1,9 +1,19 @@ +#! /usr/bin/env python +""" +Creation of PacMath sprite and movement +@license: U{http://creativecommons.org/licenses/by-sa/3.0/us/} +""" + from basicMovement import basicMovement import pygame import sys class pacmanMovement(pygame.sprite.Sprite): def __init__(self, position): + """ + Creates a PacMath sprite + @param position: location of pacmath in maze + """ pygame.sprite.Sprite.__init__(self) self.name = 'PacMath' self.ppl = False @@ -31,6 +41,13 @@ class pacmanMovement(pygame.sprite.Sprite): self.rect.y = 350 def update(self, screen, event, MAZE_SIZE, mazeObj): + """ + Updates Pacmath sprite when directional key is pressed + @param screen: the screen in which we will draw + @param event: directional key + @param MAZE_SIZE: size of maze + @param mazeObj: an instance of the maze + """ # call basic movement and add any other update amount = [0, 0] diff --git a/dev/pacmath.activity/pacmanMovement.pyc b/dev/pacmath.activity/pacmanMovement.pyc Binary files differindex db25da3..e5ea7ea 100644 --- a/dev/pacmath.activity/pacmanMovement.pyc +++ b/dev/pacmath.activity/pacmanMovement.pyc diff --git a/dev/pacmath.activity/question.py b/dev/pacmath.activity/question.py index 5fad890..2f8af0b 100644 --- a/dev/pacmath.activity/question.py +++ b/dev/pacmath.activity/question.py @@ -1,9 +1,19 @@ -#Abel Rendon Jr +#! /usr/bin/env python +""" +Set up questions and answers with draw functions +@license: U{http://creativecommons.org/licenses/by-sa/3.0/us/} +""" import pygame import random class question: - + """ + @var A: Properties of answer box [color, (left, top), center, ghost location] + @var B: Properties of answer box [color, (left, top), center, ghost location] + @var C: Properties of answer box [color, (left, top), center, ghost location] + @var D: Properties of answer box [color, (left, top), center, ghost location] + @var SIZE: Size of answer box + """ # Properties of rectangles: [color, (left, top), center, ghost location] A = [(0, 255, 255), (625, 0), (735, 15), "./images/ghost.gif"] B = [(255, 0, 0), (625, 79), (735, 94), "./images/ghost2.gif"] @@ -15,6 +25,11 @@ class question: # Default def __init__ (self, screen, quests): + """ + Randomly selects which questions are goign to be used and draws teh answer + @param screen: the screen in which we will draw + @param quests: array a questions with answers + """ # Draw the answers and questions self.question = quests self.q1 = random.randint(0, 3) @@ -35,6 +50,12 @@ class question: # Draws the answer in a ghost colored rectangle def drawAnswer(self, screen, answer, choice): + """ + Draws answers in a color coded box + @param screen: the screen in which we will draw + @param answer: answer to be drawn + @param choice: which choice from 1-4 + """ # Font used font = pygame.font.Font(None, 72) @@ -70,6 +91,11 @@ class question: # Draws the question def drawQuestion(self, screen, question): + """ + Draws the question + @param screen: the screen in which we will draw + @param question: question to be drawn + """ # Font used font = pygame.font.Font(None, 72) diff --git a/dev/pacmath.activity/question.pyc b/dev/pacmath.activity/question.pyc Binary files differindex c752a56..f39a973 100644 --- a/dev/pacmath.activity/question.pyc +++ b/dev/pacmath.activity/question.pyc |