Exemplo n.º 1
0
 def draw(self):
     glPushMatrix()
     glColor4f(0, 0, 1, 0.3)
     glTranslate(*self.pos)
     glBegin(GL_POLYGON)  # replaced by drawmodel_sect_pool
     for x, y in math.CSround(int(round(10 * self.r)), r=self.r):
         glVertex(x, y, 0)
     glEnd()
     # Fixed barriers
     glColor4f(0.8, 0.8, 0.8, 1)
     for x, y in math.CSround(int(round(2 * self.r)), r=self.r):
         glPushMatrix()
         glTranslate(x, y, 0)
         graphics.drawsphere(0.2)
         glPopMatrix()
     # Food fountain
     if self.hasfood:
         glColor4f(1, 0, 1, 1)
         glPointSize(2)
         glBegin(GL_POINTS)
         for jfood in range(50):
             x, y = math.CS(jfood * math.phi,
                            self.r / 2 * (jfood**2 * math.phi % 1))
             z = 3 * (
                 (jfood**3 * math.phi + pygame.time.get_ticks() * 0.001) %
                 1)**2
             glVertex(x, y, z)
         glEnd()
     glPopMatrix()
Exemplo n.º 2
0
def sectors(Fspot):
    posB, BrF = Fspot
    color = pygame.Color("#9999aa")
    for j in range(1, 7):
        pygame.draw.circle(pview.screen, color, T(posB), T(BrF * j / 6), T(1))
    for a in (0, 60, 120):
        C, S = math.CS(math.radians(a))
        drawlinesF(Fspot, [(S, C), (-S, -C)], color)
    for C, S in math.CSround(6, 1, 1 / 2):
        drawlinesF(Fspot, [(S, C), (S / 3, C / 3)], color)
    for C, S in math.CSround(12, 1, 1 / 2):
        drawlinesF(Fspot, [(S, C), (2 * S / 3, 2 * C / 3)], color)
Exemplo n.º 3
0
def setbuttons():
    self.buttons = []

    if self.page == "main":
        self.buttons.append(hud.Button(((1200, 640), 50), "Quit"))
    else:
        self.buttons.append(hud.Button(((1200, 640), 50), "Main\nMenu"))

    if self.page == "main":
        x, y = pview.center0
        s = pview.s0 / 12
        self.buttons += [
            hud.Button(((x - 4.5 * s, y), s), "Story/\nTutorial"),
        ]
        if progress.donestory:
            self.buttons += [
                hud.Button(((x - 1.5 * s, y), s), "Gallery"),
                hud.Button(((x + 1.5 * s, y), s), "Free\nPlay"),
                hud.Button(((x + 4.5 * s, y), s), "Bonus\nStages"),
            ]
    if self.page == "story":
        x, y = pview.center0
        s = pview.s0 / 14
        for j, (C, S) in enumerate(math.CSround(6, 2.4 * s), 1):
            if j > progress.stage:
                continue
            pos = 640 + S, 400 - C
            self.buttons += [
                hud.Button((pos, s), "Stage %s" % j),
            ]

    if self.page == "bonus":
        x, y = pview.center0
        s = pview.s0 / 14
        for j in (1, 2, 3):
            dx = 1.2 * s * (j - 2)
            dy = 1.2 * math.sqrt(3) * s * (j - 2)
            if j <= progress.stageshapes:
                pos = 340 + dx, 400 + dy
                self.buttons += [hud.Button((pos, s), "Shape %s" % j)]
            if j <= progress.stagecolors:
                pos = 640 + dx, 400 + dy
                self.buttons += [hud.Button((pos, s), "Color %s" % j)]
            if j <= progress.stagesizes:
                pos = 940 + dx, 400 + dy
                self.buttons += [hud.Button((pos, s), "Size %s" % j)]
Exemplo n.º 4
0
 def polygon(self, f=1):
     sx, sy = self.anchors[0]
     dx, dy = math.norm((sx, sy))
     rs = [f * self.r * (1 / 2 if j % 2 else 1) for j in range(10)]
     return [(sx + r * dx * S + r * dy * C, sy - r * dx * C + r * dy * S)
             for r, (S, C) in zip(rs, math.CSround(10))]
Exemplo n.º 5
0
def heximg(s, color):
	img = pygame.Surface((2 * s, 2 * s)).convert_alpha()
	img.fill((0, 0, 0, 0))
	ps = [I(s + C, s + S) for C, S in math.CSround(6, 0.99 * s, 0.5)]
	pygame.draw.polygon(img, color, ps, 0)
	return img