問下這裡的position是什麼意思?是誰的對象?
import pygame
class Bullet1(pygame.sprite.Sprite):
def init(self, position):
pygame.sprite.Sprite.init(self)
self.image = pygame.image.load("images/bullet1.png").convert_alpha() self.rect = self.image.get_rect() self.rect.left, self.rect.top = position self.speed = 12 self.active = True self.mask = pygame.mask.from_surface(self.image)def move(self): self.rect.top -= self.speed if self.rect.top < 0: self.active = Falsedef reset(self, position): self.rect.left, self.rect.top = position self.active = True