def __init__(self, sprite_filename, target, speed): """sprite_filename is the sprite file target is the Sprite that the bullet follows """ ASprite.__init__(self, sprite_filename, speed) self.target = target self.speed = speed
def __init__(self, window_size, sprite_filename, speed, x, y): """Creates the enemy and places in the default upper left position window_size is a tuple with the window dimensions (width, height) sprite_filename is the sprite for the ship speed is the number of pixels it can move at once x, y are the sprite's column and row (resp.) in the formation """ ASprite.__init__(self, sprite_filename, speed) self.window_size = window_size self.col = x self.row = y
def __init__(self, window_size, sprite_filename, speed, position, direction): """Creates a bullet that moves vertically window_size is a tuple with the window dimensions (width, height) sprite_filename is the sprite for the bullet speed is the number of pixels moved each frame position is a tuple for the coordinates of the center of the bullet direction is a vector """ ASprite.__init__(self, sprite_filename, speed) self.window_size = window_size self.direction = direction self.rect = self.image.get_rect(center = position)
def __init__(self, window_size, sprite_filename, speed): """Creates the player's ship window_size is a tuple with the window dimensions (width, height) sprite_filename is the sprite for the ship speed is the number of pixels per frame that can be moved """ ASprite.__init__(self, sprite_filename, speed) self.window_size = window_size #The ship always starts at the bottom center of the screen bottom_pos = window_size[1] - 10 x_pos = window_size[0] / 2 self.rect = self.image.get_rect(bottom = bottom_pos, centerx = x_pos)
def __init__(self, sprite_filename, speed, position, direction): ASprite.__init__(self, sprite_filename, speed) self.rect.center = position self.direction = direction