def __init__(self, pos, angle): Bullet.__init__(self, pos, angle) self.image = pygame.image.load("Resources/powerUps/pierce.png") self.rect = self.image.get_rect() self.angle = angle self.rot_angle = self.angle - 90 rot_image = pygame.transform.rotate(self.image, self.rot_angle) rot_rect = self.rect.copy() rot_rect.center = rot_image.get_rect().center rot_image = rot_image.subsurface(rot_rect) self.image = rot_image self.place(pos) self.radius = self.rect.height/2
def __init__(self, x, y, speedX, speedY, throwDistance): Bullet.__init__(self, x, y, speedX, speedY, "items-1small.png", None, Rect(110, 120, 9, 11)) self.rect = Rect(x, y, 0, 0) self.speedX = speedX self.speedY = speedY # Important if you want pinpoint accuracy self.floatX = float(self.rect.x) self.floatY = float(self.rect.y) if throwDistance > MAX_THROW_DISTANCE: throwDistance = MAX_THROW_DISTANCE self.timeToStop = throwDistance / GRENADE_SPEED self.timeToBoom = TIME_TO_BOOM
def __init__(self, creator, x, y, speedX, speedY, throwDistance): Bullet.__init__(self, creator, x, y, speedX, speedY, "items-1small.png", None, Rect(110, 120, 9, 11)) self.rect = Rect(x, y, 0, 0) self.speedX = speedX self.speedY = speedY # Important if you want pinpoint accuracy self.floatX = float(self.rect.x) self.floatY = float(self.rect.y) if throwDistance > MAX_THROW_DISTANCE: throwDistance = MAX_THROW_DISTANCE self.timeToStop = throwDistance / GRENADE_SPEED self.timeToBoom = TIME_TO_BOOM self.atk = 70
def __init__(self, x, y, vx, vy, speed=10): Bullet.__init__(self, x, y, vx, vy, speed) self.angle = math.atan2(mouseY - HEIGHT / 2, mouseX - WIDTH / 2) + HALF_PI