1 Star 0 Fork 3

小歆慧/python_pygame_plant_vs_zoomie_game_from_scratch

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
Peashooter.py 866 Bytes
一键复制 编辑 原始数据 按行查看 历史
songbo 提交于 2022-09-02 17:45 . init
import pygame
class Peashooter(pygame.sprite.Sprite):
def __init__(self):
super(Peashooter,self).__init__()
self.image = pygame.image.load('material/images/Peashooter_00.png').convert_alpha()
self.images = [pygame.image.load('material/images/Peashooter_{:02d}.png'.format(i)).convert_alpha() for i in range(0,13)]
self.rect = self.images[0].get_rect()
self.rect.top = 100
self.rect.left = 250
self.energy = 3*15
self.zombies = set()
def update(self, *args):
for zombie in self.zombies:
if zombie.isAlive == False:
continue
self.energy -= 1
if self.energy <= 0:
for zombie in self.zombies:
zombie.isMeetWallNut = False
self.kill()
self.image = self.images[args[0] % len(self.images)]
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/liberty98/python_pygame_plant_vs_zoomie_game_from_scratch.git
git@gitee.com:liberty98/python_pygame_plant_vs_zoomie_game_from_scratch.git
liberty98
python_pygame_plant_vs_zoomie_game_from_scratch
python_pygame_plant_vs_zoomie_game_from_scratch
master

搜索帮助