
下面是部分代码预览:
"""
最顶层的游戏框架设计代码,碰彩球游戏
"""
from ball import *
from cover import *
def start_game(screen):
"""
screen是屏幕对象
本函数生成游戏中的各个对象,进入游戏循环,
返回游戏成功或失败的逻辑值
"""
def display(screen,image):
"""
本函数只是显示一个image,
直到按窗口关闭按钮才会退出Pygame
"""
image = pygame.image.load(image)
screen.blit(image,(0,0))
while not pygame.event.get(QUIT):pass
pygame.quit()
def main():
cover_image = "images/gingerbread.png"
screen = display_cover(cover_image)
if screen == None: return
success = start_game(screen)
if success:
image = "images/success.png"
else:
image = "image/fail.png"
display(screen,image)
if __name__ == "__main__":
main()
下载完整源代码与素材,请
需要浏览更多吗?
成为会员后,登陆才能继续浏览!联系微信scratch8即可办理会员。
(会员专属:能浏览所有文章,下载所有带链接的Python资源。)

