夜光序言:
水蓝色如水,温柔,宁静,忧郁,纯洁
冰蓝色如冰,尖锐,冷酷,冰冷,晶莹
冰是水做成的,冰的心里是水。
不要咒骂冰的冷酷,因为冰的心里是水。即使是冷漠的外表,也无法改变柔弱的心。
正文:在之前五十多篇基础之上,我们学习小游戏开发~~
安装pygame。下载pygame。
pygame下载地址:http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame
可以用IE试下,如果报错404~~
注意细节,安装时~
之后我们进入python shell 命令界面,导入包,试验一下第一个程序:
# 夜光:第一个案例~~
import pygame,sys
from pygame.locals import *
yellow = 255,255,0
blue = 0,200,200
pygame.init()
screen = pygame.display.set_mode((600,500))
myfont = pygame.font.Font(None,60)
textImage = myfont.render("Genius:"
"Hello Pygame", True, yellow)
while True:
for event in pygame.event.get():
if event.type in (QUIT, KEYDOWN):
sys.exit()
screen.fill(blue)
screen.blit(textImage, (100,100))
pygame.display.update()