You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
726 B

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
  1. import pygame
  2. class Bullet(pygame.sprite.Sprite):
  3. def __init__(self, parent, textures, bigger):
  4. super().__init__()
  5. self.width = 6 * (1+int(bigger))
  6. self.height = 14 * (1+int(bigger))
  7. self.image = pygame.transform.scale(textures.get_texture("BULLET"), (self.width, self.height))
  8. self.rect = self.image.get_rect()
  9. self.rect.x = parent.rect.x + parent.width/2 - self.width/2
  10. self.rect.y = parent.rect.y + parent.height/2
  11. self.speed = 5
  12. self.type = "PLAYER"
  13. self.parent = parent
  14. def set_position(self,x,y):
  15. self.rect.x, self.rect.y = x,y
  16. def update(self):
  17. self.rect.y -= self.speed #direction may need editing?