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.

23 lines
657 B

# PeaBullet.py
import pygame
from Constant import scrrr_width
# 豌豆子弹类
class PeaBullet(pygame.sprite.Sprite):
def __init__(self, peashooter, damage):
self.live = True
self.image = pygame.image.load("imgs/peabullet.png")
self.damage = damage
self.speed = 10
self.rect = self.image.get_rect()
self.rect.x = peashooter.rect.x + 60
self.rect.y = peashooter.rect.y + 15
def move_bullet(self):
# 在屏幕范围内,实现往右移动
if self.rect.x < scrrr_width:
self.rect.x += self.speed
else:
self.live = False