开发者

First time programming in livewires module, How do I make a start page for my executable game?

开发者 https://www.devze.com 2023-01-31 08:36 出处:网络
I want my game to go to a title slide first and return to that slide when the character dies (its an asteroids clone) any help would be much appre开发者_如何转开发ciated.Check out the pygame module. T

I want my game to go to a title slide first and return to that slide when the character dies (its an asteroids clone) any help would be much appre开发者_如何转开发ciated.


Check out the pygame module. There are a number of tutorials that will get you up running fairly quickly.

Example from lecture 3 of "Python game programming" (first tutorial):

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()) 
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号