![](https://img-blog.csdnimg.cn/20190918140053667.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
pygame
根据书籍<python游戏编程入门>学习实践
x星云Nebularr
这个作者很懒,什么都没留下…
展开
-
06-逃脱恐龙游戏(精灵动画)
# Sprite Animation Demo# Chapter 7import pygamefrom pygame.locals import *class MySprite(pygame.sprite.Sprite): def __init__(self, target): pygame.sprite.Sprite.__init__(self) #exten...原创 2020-03-01 14:10:08 · 746 阅读 · 4 评论 -
05-数学运算解决飞船圆周运动
位图space = pygame.image.load("space.png").convert_alpha()planet = pygame.image.load("planet2.png").convert_alpha()ship = pygame.image.load("freelance.png").convert_alpha()利用此函数可以加载位图,convert()可以将...原创 2020-02-29 10:16:45 · 433 阅读 · 0 评论 -
04-时钟游戏(利用math模块)
format小数":.2f".format(3.1415926)计算机进行三角函数运算时候非常消耗资源,因此可以利用程序加载时间把结果提前运算出来存在数组中.绘制圆圈import random, math, sys, pygamefrom pygame.locals import *pygame.init()screen = pygame.display.set_mode((6...原创 2020-02-27 14:22:23 · 209 阅读 · 0 评论 -
03-接炸弹小游戏(处理事件)
处理事件用while True:处理事件while True: for event in pygame.event.get(): if event.type == QUIT: sys.exit() elif event.type == MOUSEMOTION: pass elif eve...原创 2020-02-26 21:34:51 · 461 阅读 · 1 评论 -
02-IO,数据和字体:Trivia游戏(文字文件处理)
# The Trivia Game# Chapter 3import sys, pygamefrom pygame.locals import *class Trivia(object): def __init__(self, filename): self.data = [] self.current = 0 self.tot...原创 2020-02-25 14:01:54 · 314 阅读 · 1 评论 -
01-pie小游戏(基本图形的绘制)
写在前面:去年四月份,跟着某马的Python班利用pygame模块做了个飞机大战,如今刚刚找到工作,祖传技能不能丢,虽然农药已经戒了,但咱们可以转开发游戏呀哈哈!今天跟着书中的例子一个个敲出来,每天记录自己的进步!加油绘制文字ps:这里出事了,跟着网上弄了很久也安不上pygame模块,自己用了科学冲浪的方式才终于用pip3给安好了。# -*- coding: utf-8 -*-...原创 2020-02-24 23:19:34 · 721 阅读 · 1 评论