Example #1
0
 def createHexObstacle(self):
     numOfSides = random.choice([2, 3, 4, 5])
     sideList = Obstacles.chooseHexSides(numOfSides)
     obstacleType = "Hexagon"
     angle = self.randomAngle()
     newObstacle = Obstacles(self.width, self.height, numOfSides, sideList,
                             self.backColor, self.currentRotDir,
                             obstacleType, angle)
     self.obstacles.append(newObstacle)
Example #2
0
 def createSquareObstacle(self):
     if self.obstacleCount % 5 == 0 and self.obstacleCount < 7:
         self.hardObstacleCount += 1
         self.createSquareZigObstacle()
     elif self.checkHardObsPresent():
         numOfSides = 3
         sideList = Obstacles.chooseSquareSides(numOfSides)
         obstacleType = "Square"
         angle = self.randomAngle()
         newObstacle = Obstacles(self.width, self.height, numOfSides,
                                 sideList, self.backColor,
                                 self.currentRotDir, obstacleType, angle)
         self.obstacles.append(newObstacle)
Example #3
0
 def createPentObstacle(self):
     if self.obstacleCount % 5 == 0 and self.obstacleCount < 7:
         self.hardObstacleCount += 1
         self.createPentWhirlpoolObstacle()
     elif self.checkHardObsPresent():
         numOfSides = 4
         sideList = Obstacles.choosePentSides(numOfSides)
         obstacleType = "Pentagon"
         angle = self.randomAngle()
         newObstacle = Obstacles(self.width, self.height, numOfSides,
                                 sideList, self.backColor,
                                 self.currentRotDir, obstacleType, angle)
         self.obstacles.append(newObstacle)
Example #4
0
 def createHexObstacle(self):
     numOfSides = random.choice([2,3,4,5])
     sideList = Obstacles.chooseHexSides(numOfSides)
     obstacleType = "Hexagon"
     angle = self.randomAngle()
     newObstacle = Obstacles(self.width,self.height,numOfSides,sideList,
                                 self.backColor,self.currentRotDir,
                                 obstacleType,angle)
     self.obstacles.append(newObstacle)
Example #5
0
 def createSquareObstacle(self):
     if self.obstacleCount % 5 == 0 and self.obstacleCount < 7:
         self.hardObstacleCount +=1
         self.createSquareZigObstacle()
     elif self.checkHardObsPresent():
         numOfSides = 3
         sideList = Obstacles.chooseSquareSides(numOfSides)
         obstacleType = "Square"
         angle = self.randomAngle()
         newObstacle = Obstacles(self.width,self.height,numOfSides,sideList,
             self.backColor,self.currentRotDir, obstacleType,angle)
         self.obstacles.append(newObstacle)
Example #6
0
 def createPentObstacle(self):
     if self.obstacleCount % 5 == 0 and self.obstacleCount < 7:
         self.hardObstacleCount +=1
         self.createPentWhirlpoolObstacle()
     elif self.checkHardObsPresent():
         numOfSides = 4
         sideList = Obstacles.choosePentSides(numOfSides)
         obstacleType = "Pentagon"
         angle = self.randomAngle()
         newObstacle = Obstacles(self.width,self.height,numOfSides,sideList,
             self.backColor,self.currentRotDir,obstacleType,angle)
         self.obstacles.append(newObstacle)
Example #7
0
 def changeBackColor(self):
     while True:
         newColor = random.choice(["navy","mint cream","dark orchid",
                     "MediumPurple4","firebrick","gold4","black","black"])
         if newColor != self.backColor:
             break
     self.backColor = newColor
     (self.background.pulseColor,self.background.pentagonColor) =  \
                             Background.choosePulseColor(self.background)
     self.newCharacter.color = \
                             Character.chooseCharColor(self.newCharacter)
     self.basePolygon.baseColor = \
                         BasePolygon.choosePulseColor(self.basePolygon)
     for obstacle in self.obstacles:
         obstacle.color = Obstacles.chooseObstacleColor(obstacle)
Example #8
0
 def createSquareZigObstacle(self):
     numOfSides = 1
     sideList = [0]
     obstacleType = "Square Zig"
     wSides = 10
     radius = 500
     angle = math.pi / 2
     for i in xrange(wSides):
         newObstacle = Obstacles(self.width, self.height, numOfSides,
                                 sideList, self.backColor,
                                 self.currentRotDir, obstacleType, angle,
                                 radius)
         self.obstacles.append(newObstacle)
         radius += 100
         angle += math.pi / 2
Example #9
0
 def createStairObstacle(self):
     numOfSides = 4
     sideList = [0, 2, 3, 5]
     obstacleType = "Stairs"
     #pattern of 2 adjacent sides
     sSides = 3
     radius = 500
     angle = math.pi / 2
     for i in xrange(sSides):
         newObstacle = Obstacles(self.width, self.height, numOfSides,
                                 sideList, self.backColor,
                                 self.currentRotDir, obstacleType, angle,
                                 radius)
         self.obstacles.append(newObstacle)
         radius += 250
         angle += math.pi / 3
Example #10
0
 def createMultiCObstacle(self):
     numOfSides = 5
     sideList = [1, 2, 3, 4, 5]
     obstacleType = "MultiC"
     #it is a 6 hexagon pattern
     nHexagons = 4
     radius = 500
     angle = math.pi / 2
     for i in xrange(nHexagons):
         newObstacle = Obstacles(self.width, self.height, numOfSides,
                                 sideList, self.backColor,
                                 self.currentRotDir, obstacleType, angle,
                                 radius)
         self.obstacles.append(newObstacle)
         radius += 250
         angle += math.pi / 3
Example #11
0
 def changeBackColor(self):
     while True:
         newColor = random.choice([
             "navy", "mint cream", "dark orchid", "MediumPurple4",
             "firebrick", "gold4", "black", "black"
         ])
         if newColor != self.backColor:
             break
     self.backColor = newColor
     (self.background.pulseColor,self.background.pentagonColor) =  \
                             Background.choosePulseColor(self.background)
     self.newCharacter.color = \
                             Character.chooseCharColor(self.newCharacter)
     self.basePolygon.baseColor = \
                         BasePolygon.choosePulseColor(self.basePolygon)
     for obstacle in self.obstacles:
         obstacle.color = Obstacles.chooseObstacleColor(obstacle)
Example #12
0
 def drawObstacles(self):
     pi = math.pi
     canvas = self.canvas
     for obstacle in self.obstacles:
         Obstacles.draw(obstacle,canvas,self.basePolygon.baseType,
                                         obstacle.obstacleType)
Example #13
0
 def drawObstacles(self):
     pi = math.pi
     canvas = self.canvas
     for obstacle in self.obstacles:
         Obstacles.draw(obstacle, canvas, self.basePolygon.baseType,
                        obstacle.obstacleType)