ADD file via upload

main
ppqz7ofga 7 months ago
parent c3888b79af
commit 7da24ee07a

@ -0,0 +1,22 @@
# 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
Loading…
Cancel
Save