第一次在livewires模块编程,如何为我的可执行游戏制作一个开始页面?
我想让我的游戏先显示一个标题画面,当角色死亡时再返回这个画面(这是一个类似于“小行星”的游戏)。如果有人能帮帮我,我会非常感激。
1 个回答
0
可以看看这个叫做 pygame 的模块。这里有很多 教程,能让你很快上手。
这是“Python游戏编程”课程的第三讲中的一个例子(第一个教程):
import pygame, sys,os
from pygame.locals import *
pygame.init()
window = pygame.display.set_mode((468, 60))
pygame.display.set_caption('Monkey Fever')
screen = pygame.display.get_surface()
monkey_head_file_name = os.path.join("data","chimp.bmp")
monkey_surface = pygame.image.load(monkey_head_file_name)
screen.blit(monkey_surface, (0,0))
pygame.display.flip()
def input(events):
for event in events:
if event.type == QUIT:
sys.exit(0)
else:
print event
while True:
input(pygame.event.get())