1 Star 3 Fork 3

kamiba/python_pygame_plant_vs_zoomie_game_from_scratch

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
Sun.py 653 Bytes
一键复制 编辑 原始数据 按行查看 历史
songbo 提交于 2022-09-02 17:45 . init
import random
import pygame
class Sun(pygame.sprite.Sprite):
def __init__(self,rect):
super(Sun,self).__init__()
self.image = pygame.image.load('material/images/Sun_1.png').convert_alpha()
self.images = [pygame.image.load('material/images/Sun_{}.png'.format(i)).convert_alpha() for i in range(1,18)]
self.rect = self.images[0].get_rect()
offsetTop = random.randint(-50,50)
offsetLeft = random.randint(-50,50)
self.rect.top = rect.top + offsetTop
self.rect.left = rect.left + offsetLeft
def update(self, *args):
self.image = self.images[args[0] % len(self.images)]
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/kamiba/python_pygame_plant_vs_zoomie_game_from_scratch.git
git@gitee.com:kamiba/python_pygame_plant_vs_zoomie_game_from_scratch.git
kamiba
python_pygame_plant_vs_zoomie_game_from_scratch
python_pygame_plant_vs_zoomie_game_from_scratch
master

搜索帮助