Exemplo n.º 1
0
    def __init__(self, pos, speed, angle, groups):
        Obj.__init__(self, pos, speed, groups)
        self.speed = speed
        self.angle = angle
        self.speed = speed
        self.pos = pos
        self.radius = 6
        self.base_image = pygame.Surface((5,5))
        self.color = (0, 0, 255)
        self.transparent = (1,2,3)
        self.base_image.fill(self.transparent)
        self.base_image.set_colorkey(self.transparent)
        self.speed.x += math.cos(angle)
        self.speed.y += math.sin(angle)

        pygame.draw.circle(self.base_image, self.color, self.pos, self.radius)
        self.image = self.base_image.copy()
        self.rect = self.image.get_rect(center=self.pos)
Exemplo n.º 2
0
    def __init__(self, pos, speed, radius, groups, screen):
        Obj.__init__(self, pos, speed, groups)

        self.radius = radius
        self.bullets = 100
        self.speed = speed
        self.max_speed = 10.0
        self.thrust_value = 1.0
        self.turn_speed = 4.0
        self.angle = 0
        self.speed = speed
        self.points = [(0, 0), (0, 10), (20, 5)]
        self.base_image = pygame.Surface((21, 11))
        self.color = (255, 255, 255)
        self.center = screen.size / 2
        self.transparent = (1, 2, 3)
        self.base_image.fill(self.transparent)
        self.base_image.set_colorkey(self.transparent)

        pygame.draw.polygon(self.base_image, self.color, self.points)
        self.image = self.base_image.copy()
        self.rect = self.image.get_rect(center=self.center)

        self.center = self.rect.center