Exemplo n.º 1
0
    def __init__(self, surface):
        Setup.__init__(self, surface)

        platformW = int(params.WIDTH * 0.10)
        platformH = int(params.HEIGHT * 0.30)
        platformX = int(params.WIDTH * 0.3 - platformW * 0.5)
        platformY = int(params.HEIGHT - platformH)
        platform1 = objects.Obstacle(surface=self.surface,
                                     color=objects.OBSTACLE_COLOR,
                                     rect=(platformX, platformY, platformW,
                                           platformH))

        self.diamondX = platformX - objects.DIAMOND_RADIUS  ## Initial diamond x
        self.diamondY = params.HEIGHT - objects.DIAMOND_RADIUS  ## Initial diamond y
        diamond1 = objects.Diamond(surface=self.surface,
                                   color=objects.DIAMOND_COLOR,
                                   x=self.diamondX,
                                   y=self.diamondY,
                                   radius=objects.DIAMOND_RADIUS)

        platformW = int(params.WIDTH * 0.10)
        platformH = int(params.HEIGHT * 0.30)
        platformX = int(params.WIDTH * 0.7 - platformW * 0.5)
        platformY = int(params.HEIGHT - platformH)
        platform2 = objects.Obstacle(surface=self.surface,
                                     color=objects.OBSTACLE_COLOR,
                                     rect=(platformX, platformY, platformW,
                                           platformH))

        self.diamondX = platformX + platformW + objects.DIAMOND_RADIUS  ## Initial diamond x
        self.diamondY = params.HEIGHT - objects.DIAMOND_RADIUS  ## Initial diamond y
        diamond2 = objects.Diamond(surface=self.surface,
                                   color=objects.DIAMOND_COLOR,
                                   x=self.diamondX,
                                   y=self.diamondY,
                                   radius=objects.DIAMOND_RADIUS)

        obstacles = [platform1, platform2]

        ballX = random.randint(params.WIDTH * 0.5, params.WIDTH * 0.55)
        ballY = params.HEIGHT * 0.95 - objects.BALL_RADIUS
        dotAngle = 0.0
        ball = objects.Ball(surface=self.surface,
                            color=objects.BALL_COLOR,
                            x=ballX,
                            y=ballY,
                            radius=objects.BALL_RADIUS,
                            dotAngle=dotAngle,
                            obstacles=obstacles)

        diamonds = [diamond1, diamond2]

        self.obstacles, self.ball, self.diamonds = (obstacles, ball, diamonds)

        self.maxCollectTime = 9  ## Ideal max completion time in seconds to collect all diamond
Exemplo n.º 2
0
    def __init__(self, surface):
        Setup.__init__(self, surface)

        ballX = random.randint(params.WIDTH * 0.1, params.WIDTH * 0.9)
        ballY = params.HEIGHT * 0.95 - objects.BALL_RADIUS
        dotAngle = 0.0
        ball = objects.Ball(surface=self.surface,
                            color=objects.BALL_COLOR,
                            x=ballX,
                            y=ballY,
                            radius=objects.BALL_RADIUS,
                            dotAngle=dotAngle,
                            obstacles=[None])

        diamondX = random.randint(2 * objects.DIAMOND_RADIUS, params.WIDTH -
                                  objects.DIAMOND_RADIUS)  ## Initial diamond x
        diamondY = random.randint(
            params.HEIGHT * 0.5 + 2 * objects.DIAMOND_RADIUS,
            params.HEIGHT - objects.DIAMOND_RADIUS)  ## Initial diamond y
        diamond = objects.Diamond(surface=self.surface,
                                  color=objects.DIAMOND_COLOR,
                                  x=diamondX,
                                  y=diamondY,
                                  radius=objects.DIAMOND_RADIUS)

        self.obstacles, self.ball, self.diamonds = ([None], ball, [diamond])

        self.maxCollectTime = 3  ## Ideal max completion time in seconds to collect all diamond