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.
25 lines
773 B
25 lines
773 B
6 months ago
|
import os
|
||
|
|
||
|
import pygame
|
||
|
import random
|
||
|
|
||
|
from common_func import get_base_path
|
||
|
|
||
|
|
||
|
class Sun2(pygame.sprite.Sprite):
|
||
|
def __init__(self):
|
||
|
super(Sun2, self).__init__()
|
||
|
self.image = pygame.image.load(os.path.join(get_base_path(), 'images/Sun/Sun_01.png')).convert_alpha()
|
||
|
self.images = [
|
||
|
pygame.image.load(os.path.join(get_base_path(), 'images/Sun/Sun_{:02d}.png'.format(i))).convert_alpha()
|
||
|
for i in range(1, 14)]
|
||
|
self.rect = self.images[1].get_rect()
|
||
|
self.rect.left = random.randint(50, 720)
|
||
|
self.rect.top = -50
|
||
|
self.speed = 2
|
||
|
|
||
|
def update(self, *args):
|
||
|
self.image = self.images[args[0] % len(self.images)]
|
||
|
if self.rect.bottom < 560:
|
||
|
self.rect.top += self.speed
|