def draw(self, surface, flags):              
        bp = intpos(self._worldobj.body.position)
        rotimg = Cache().getRotatedImage(self._imageName, math.degrees(-self._worldobj.body.angle))
        w, h = rotimg.get_rect().size
        #TODO: convert world to graphics coordinates
        surface.blit(rotimg, (bp[0] -w/2, bp[1] -h/2))

        #if flags["DEBUG"]:
        #pygame.draw.line(surface, (64, 128, 255), bp, intpos(self._worldobj.body.position - (self._worldobj.pull / 50, 0)))
        if flags["DEBUG"]:
            bp = intpos(self._worldobj.body.position)
            wrapcircle(surface, (64, 64, 255), bp, self._worldobj.influence_range, self._world.size, 3)
            if self._worldobj.type == WormHole.RANDOM:
                # make 'X' for Random
                pygame.draw.line(surface, (64, 64, 255), intpos(self._worldobj.body.position - (self._worldobj.influence_range, self._worldobj.influence_range)), intpos(self._worldobj.body.position + (self._worldobj.influence_range, self._worldobj.influence_range)), 5)
                pygame.draw.line(surface, (64, 64, 255), intpos(self._worldobj.body.position - (-self._worldobj.influence_range, self._worldobj.influence_range)), intpos(self._worldobj.body.position + (-self._worldobj.influence_range, self._worldobj.influence_range)), 5)
            elif self._worldobj.type == WormHole.FIXED_POINT:
                pygame.draw.line(surface, (64, 64, 255), bp, intpos(self._worldobj.exit))
                wrapcircle(surface, (64, 64, 255), intpos(self._worldobj.exit), self._worldobj.radius / 2, self._world.size, 2) # 'target'
            elif self._worldobj.type == WormHole.OTHER_CELESTIALBODY:
                c = (64, 64, 255)
                if isinstance(self._worldobj.exit, WormHole) and isinstance(self._worldobj.exit.exit, WormHole) and self._worldobj.exit.exit == self._worldobj:
                    c = (128, 192, 255) # check if linked in both directions - make brighter if two-way wormhole
                pygame.draw.line(surface, c, bp, intpos(self._worldobj.exit.body.position))
                wrapcircle(surface, c, intpos(self._worldobj.exit.body.position), self._worldobj.radius / 2, self._world.size, 2) # 'target'

        super(WormHoleGUI, self).draw(surface, flags)
    def draw(self, surface, flags):      
        ang = 45 - self._worldobj.body.velocity.angle_degrees
        rang = math.radians(self._worldobj.body.velocity.angle_degrees)
        #rotimg = pygame.transform.rotate(self.surface, ang)
        rotimg = Cache().getRotatedImage(self._imageName, ang)
        w, h = rotimg.get_rect().size
        #TODO: convert world to graphics coordinates
        surface.blit(rotimg, (self._worldobj.body.position[0] - w / 2 - self.__extra * math.cos(rang), self._worldobj.body.position[1] - h / 2 - self.__extra * math.sin(rang)))

        super(AsteroidGUI, self).draw(surface, flags)
    def draw(self, surface, flags):              
        bp = intpos(self._worldobj.body.position)
        rotimg = Cache().getRotatedImage(self._imageName, math.degrees(-self._worldobj.body.angle))
        w, h = rotimg.get_rect().size
        #TODO: convert world to graphics coordinates
        surface.blit(rotimg, (bp[0] -w/2, bp[1] -h/2))

        if flags["DEBUG"]:            
            pygame.draw.line(surface, (64, 128, 255), bp, intpos(self._worldobj.body.position - (self._worldobj.pull / 50, 0)))

        super(NebulaGUI, self).draw(surface, flags)
    def draw(self, surface, flags):              
        bp = intpos(self._worldobj.body.position)
        rotimg = Cache().getRotatedImage(self._imageName, math.degrees(-self._worldobj.body.angle))
        w, h = rotimg.get_rect().size
        #TODO: convert world to graphics coordinates
        surface.blit(rotimg, (bp[0] -w/2, bp[1] -h/2))

        if flags["DEBUG"]:            
            pygame.draw.line(surface, (64, 128, 255), bp, intpos(self._worldobj.body.position - (self._worldobj.pull / 50, 0)))

        super(NebulaGUI, self).draw(surface, flags)
Exemple #5
0
    def draw(self, surface, flags):
        bp = intpos(self._worldobj.body.position)
        rotimg = Cache().getRotatedImage(
            self._imageName, math.degrees(-self._worldobj.body.angle))
        w, h = rotimg.get_rect().size
        #TODO: convert world to graphics coordinates
        surface.blit(rotimg, (bp[0] - w / 2, bp[1] - h / 2))

        #if flags["DEBUG"]:
        #pygame.draw.line(surface, (64, 128, 255), bp, intpos(self._worldobj.body.position - (self._worldobj.pull / 50, 0)))
        if flags["DEBUG"]:
            bp = intpos(self._worldobj.body.position)
            wrapcircle(surface, (64, 64, 255), bp,
                       self._worldobj.influence_range, self._world.size, 3)
            if self._worldobj.type == WormHole.RANDOM:
                # make 'X' for Random
                pygame.draw.line(
                    surface, (64, 64, 255),
                    intpos(self._worldobj.body.position -
                           (self._worldobj.influence_range,
                            self._worldobj.influence_range)),
                    intpos(self._worldobj.body.position +
                           (self._worldobj.influence_range,
                            self._worldobj.influence_range)), 5)
                pygame.draw.line(
                    surface, (64, 64, 255),
                    intpos(self._worldobj.body.position -
                           (-self._worldobj.influence_range,
                            self._worldobj.influence_range)),
                    intpos(self._worldobj.body.position +
                           (-self._worldobj.influence_range,
                            self._worldobj.influence_range)), 5)
            elif self._worldobj.type == WormHole.FIXED_POINT:
                pygame.draw.line(surface, (64, 64, 255), bp,
                                 intpos(self._worldobj.exit))
                wrapcircle(surface, (64, 64, 255), intpos(self._worldobj.exit),
                           self._worldobj.radius / 2, self._world.size,
                           2)  # 'target'
            elif self._worldobj.type == WormHole.OTHER_CELESTIALBODY:
                c = (64, 64, 255)
                if isinstance(self._worldobj.exit, WormHole) and isinstance(
                        self._worldobj.exit.exit, WormHole
                ) and self._worldobj.exit.exit == self._worldobj:
                    c = (
                        128, 192, 255
                    )  # check if linked in both directions - make brighter if two-way wormhole
                pygame.draw.line(surface, c, bp,
                                 intpos(self._worldobj.exit.body.position))
                wrapcircle(surface, c,
                           intpos(self._worldobj.exit.body.position),
                           self._worldobj.radius / 2, self._world.size,
                           2)  # 'target'

        super(WormHoleGUI, self).draw(surface, flags)
Exemple #6
0
    def draw(self, surface, flags):
        ang = 45 - self._worldobj.body.velocity.angle_degrees
        rang = math.radians(self._worldobj.body.velocity.angle_degrees)
        #rotimg = pygame.transform.rotate(self.surface, ang)
        rotimg = Cache().getRotatedImage(self._imageName, ang)
        w, h = rotimg.get_rect().size
        #TODO: convert world to graphics coordinates
        surface.blit(
            rotimg,
            (self._worldobj.body.position[0] - w / 2 -
             self.__extra * math.cos(rang), self._worldobj.body.position[1] -
             h / 2 - self.__extra * math.sin(rang)))

        super(AsteroidGUI, self).draw(surface, flags)
    def draw(self, surface, flags):
        self.anicount += 1
        if self.anicount == self.anispeed:
            self.anicount = 0
            self.anirot += self.anidirection
            if self.anirot >= 360:
                self.anirot = 0
            elif self.anirot <= 0:
                self.anirot = 360
        rotimg = Cache().getRotatedImage(self._imageName, self.anirot)
        w, h = rotimg.get_rect().size
        # TODO: convert world to graphics coordinates
        surface.blit(rotimg, (self._worldobj.body.position[0] - w / 2, self._worldobj.body.position[1] - h / 2))

        if flags["DEBUG"]:
            bp = intpos(self._worldobj.body.position)
            wrapcircle(surface, (64, 64, 255), bp, self._worldobj.gravityFieldLength, self._world.size, 3)
            pygame.draw.line(
                surface,
                (64, 128, 255),
                intpos(self._worldobj.body.position - (0, self._worldobj.gravityFieldLength)),
                intpos(self._worldobj.body.position - (0, self._worldobj.gravityFieldLength - self._worldobj.pull)),
            )
            pygame.draw.line(
                surface,
                (64, 128, 255),
                intpos(self._worldobj.body.position - (self._worldobj.gravityFieldLength, 0)),
                intpos(self._worldobj.body.position - (self._worldobj.gravityFieldLength - self._worldobj.pull, 0)),
            )
            pygame.draw.line(
                surface,
                (64, 128, 255),
                intpos(self._worldobj.body.position + (self._worldobj.gravityFieldLength, 0)),
                intpos(self._worldobj.body.position + (self._worldobj.gravityFieldLength - self._worldobj.pull, 0)),
            )
            pygame.draw.line(
                surface,
                (64, 128, 255),
                intpos(self._worldobj.body.position + (0, self._worldobj.gravityFieldLength)),
                intpos(self._worldobj.body.position + (0, self._worldobj.gravityFieldLength - self._worldobj.pull)),
            )
            # radius
            surface.blit(
                debugfont().render(repr(self._worldobj.gravityFieldLength), False, (255, 255, 192)),
                intpos((bp[0], bp[1] - self._worldobj.gravityFieldLength - 16)),
            )

        super(PlanetGUI, self).draw(surface, flags)
    def draw(self, surface, flags):      
        ang = 45 - self._worldobj.body.velocity.angle_degrees
        rang = math.radians(self._worldobj.body.velocity.angle_degrees)
        #rotimg = pygame.transform.rotate(self.surface, ang)
        rotimg = Cache().getRotatedImage(self._imageName, ang)
        w, h = rotimg.get_rect().size
        #TODO: convert world to graphics coordinates
        surface.blit(rotimg, (self._worldobj.body.position[0] - w / 2 - self.__extra * math.cos(rang), self._worldobj.body.position[1] - h / 2 - self.__extra * math.sin(rang)))

        # Draw Dragon attack area
        if flags["DEBUG"] and isinstance(self._worldobj, Dragon) and self._worldobj.influence_range > 0:
            bp = intpos(self._worldobj.body.position)
            wrapcircle(surface, (64, 64, 255), bp, self._worldobj.influence_range, self._world.size, 3)
            pygame.draw.line(surface, (64, 128, 255), intpos(self._worldobj.body.position - (0, self._worldobj.influence_range)), intpos(self._worldobj.body.position - (0, self._worldobj.influence_range + self._worldobj.attack_speed)))
            pygame.draw.line(surface, (64, 128, 255), intpos(self._worldobj.body.position - (self._worldobj.influence_range, 0)), intpos(self._worldobj.body.position - (self._worldobj.influence_range + self._worldobj.attack_speed, 0)))
            pygame.draw.line(surface, (64, 128, 255), intpos(self._worldobj.body.position + (self._worldobj.influence_range, 0)), intpos(self._worldobj.body.position + (self._worldobj.influence_range + self._worldobj.attack_speed, 0)))
            pygame.draw.line(surface, (64, 128, 255), intpos(self._worldobj.body.position + (0, self._worldobj.influence_range)), intpos(self._worldobj.body.position + (0, self._worldobj.influence_range + self._worldobj.attack_speed)))
            # radius
            surface.blit(debugfont().render(repr(self._worldobj.influence_range), False, (255, 255, 192)), intpos((bp[0], bp[1] - self._worldobj.influence_range - 16)))

        super(AsteroidGUI, self).draw(surface, flags)
Exemple #9
0
    def draw(self, surface, flags):      
        self.anicount += 1
        if self.anicount == self.anispeed:
            self.anicount = 0
            self.anirot += self.anidirection
            if self.anirot >= 360: self.anirot = 0
            elif self.anirot <= 0: self.anirot = 360
        rotimg = Cache().getRotatedImage(self._imageName, self.anirot)
        w, h = rotimg.get_rect().size
        #TODO: convert world to graphics coordinates
        surface.blit(rotimg, (self._worldobj.body.position[0] -w/2, self._worldobj.body.position[1] -h/2))

        if flags["DEBUG"] and isinstance(self._worldobj, Influential) and self._worldobj.influence_range > 0:
            bp = intpos(self._worldobj.body.position)
            wrapcircle(surface, (64, 64, 255), bp, self._worldobj.influence_range, self._world.size, 3)
            pygame.draw.line(surface, (64, 128, 255), intpos(self._worldobj.body.position - (0, self._worldobj.influence_range)), intpos(self._worldobj.body.position - (0, self._worldobj.influence_range - self._worldobj.pull)))
            pygame.draw.line(surface, (64, 128, 255), intpos(self._worldobj.body.position - (self._worldobj.influence_range, 0)), intpos(self._worldobj.body.position - (self._worldobj.influence_range - self._worldobj.pull, 0)))
            pygame.draw.line(surface, (64, 128, 255), intpos(self._worldobj.body.position + (self._worldobj.influence_range, 0)), intpos(self._worldobj.body.position + (self._worldobj.influence_range - self._worldobj.pull, 0)))
            pygame.draw.line(surface, (64, 128, 255), intpos(self._worldobj.body.position + (0, self._worldobj.influence_range)), intpos(self._worldobj.body.position + (0, self._worldobj.influence_range - self._worldobj.pull)))
            # radius
            surface.blit(debugfont().render(repr(self._worldobj.influence_range), False, (255, 255, 192)), intpos((bp[0], bp[1] - self._worldobj.influence_range - 16)))

        super(PlanetGUI, self).draw(surface, flags)