泡泡摸奖系统主程序

"""
   泡泡摸奖系统.py
   在人生的舞台上,你可以单击泡泡摸奖,祝你获得健康,幸福.
"""

import pygame
from winprize.screen import *
from winprize.pop import *
from winprize.girl import * 
from time import sleep

pygame.mixer.init()
bgmusic = "眉飞色舞.wav"
pygame.mixer.music.load(bgmusic)
pygame.mixer.music.play(-1,0)
pop_sound = pygame.mixer.Sound("Pop.wav")


imagelist = ["舞台" + str(i) + ".png" for i in range(7)]
s = Dynamic_screen(title='泡泡摸奖系统',piclist=imagelist,interval=100)
screen = s.screen

girl_images = ["qq女孩秀0.gif","qq女孩秀1.gif"]
[screen.addshape(image) for image in girl_images] # 注册到形状列表
dance_girl = Girl(girl_images)                   # 生成后,它会自己"跳舞"

all_coordinates=[(-120,90),(-40,90),(40,90),(120,90),(-120,0),(-40,0),\
                 (40,0),(120,0),(-120,-90),(-40,-90),(40,-90),(120,-90)]
ac = all_coordinates                    # 仅仅是为了缩短代码而定义的别名 
pop_image_list = ["泡泡造型1.gif","泡泡造型2.gif","泡泡造型3.gif","泡泡造型4.gif"]
[screen.addshape(image) for image in pop_image_list] #注册到形状列表,image为gif图片

# 实例化12个泡泡
pops = [ Pop(pop_image_list,x,y,pop_sound) for x,y in all_coordinates]
pop_amount = len(pops)
pops[0].prize = "一等奖"
pops[1].prize = "二等奖"
pops[2].prize = "二等奖"
pops[3].prize = "三等奖"
pops[4].prize = "三等奖"
pops[5].prize = "三等奖"
    
def pop_shuffle():
    """按空格键后对泡泡的位置进行随机调换,为了演示交换过程,没有使用shuffle命令"""
    old_delay = screen.delay()
    screen.delay(2)
    screen.onkeypress(None,"space")
    [pop.set_shake(False) for pop in pops]  # 所有泡泡暂停摇摆
    sleep(0.5)
    

You must log in to read the rest of this article. Please log in or register as a user.