- 博客(11)
- 资源 (2)
- 收藏
- 关注
原创 我的世界—Python(八)
self.model.process_queue() sector = sectorize(self.position) if sector != self.sector: self.model.change_sectors(self.sector, sector) if self.sector is None: self.model.process_entire_queue()
2022-04-20 19:11:57
358
1
原创 我的世界—Python(七)
# Current (x, y, z) position in the world, specified with floats. Note # that, perhaps unlike in math class, the y-axis is the vertical axis. self.position = (0, 0, 0) # First element is rotation of the player in the x-z p
2022-04-20 19:05:47
132
原创 我的世界—Python(六)
def change_sectors(self, before, after): """ Move from sector `before` to sector `after`. A sector is a contiguous x, y sub-region of world. Sectors are used to speed up world rendering. """ before_set = set()
2022-04-20 19:01:00
311
原创 我的世界—Python(五)
texture = self.world[position] self.shown[position] = texture if immediate: self._show_block(position, texture) else: self._enqueue(self._show_block, position, texture) def _show_block(self, posi
2022-04-20 18:58:00
319
原创 我的世界—Python(四)
""" x, y, z = position for dx, dy, dz in FACES: if (x + dx, y + dy, z + dz) not in self.world: return True return False def add_block(self, position, texture, immediate=True): """ Add
2022-04-20 18:52:44
281
原创 我的世界—Python(三)
class Model(object): def __init__(self): # A Batch is a collection of vertex lists for batched rendering. self.batch = pyglet.graphics.Batch() # A TextureGroup manages an OpenGL texture. self.group = TextureGroup(imag
2022-04-20 18:49:02
347
原创 我的世界—Python(二)
TEXTURE_PATH = 'texture.png'GRASS = tex_coords((1, 0), (0, 1), (0, 0))SAND = tex_coords((1, 1), (1, 1), (1, 1))BRICK = tex_coords((2, 0), (2, 0), (2, 0))WOOD = tex_coords((1, 2), (1, 2), (1, 2))STONE = tex_coords((2, 1), (2, 1), (2, 1))ABC = tex_coo
2022-04-20 18:44:32
198
原创 我的世界—Python(一)
from __future__ import divisionimport sysimport mathimport randomimport timefrom collections import dequefrom pyglet import imagefrom pyglet.gl import *from pyglet.graphics import TextureGroupfrom pyglet.window import key, mouseTICKS_PER_SEC =
2022-04-20 17:51:59
392
原创 基础的数字类型(下)
大家好,我是会开灰机的小张!求关基的数字类型↓#比较两个数的大小a3 = 6a4 = 9print((a3>a4)-(a3<a4))#max 去比较的数的最高值print(max(a3,a4))#求x的y次方 2的5次方#pow 计算次方print(pow(2,5))#round (x[.n])返回浮点数x的四舍五入的值,如果给出n值,则代表舍入到小数点后n位print(round(3.456))print(round(3.546, 1))print(round(3.556))
2022-04-20 12:40:00
115
原创 基础数字类型(上)
你我皆MC,身在方块中!我是会开灰机的小张这是基础数字类型↓#导入库#库:封装一些功能#math:数学相关的库#random:生成随机数import randomimport math'''分类:整数、浮点数、复数''''''整数:Python可以处理任意大小的整数,当然包括负整数,在程序中的表示和数学的写法一样。'''#连续定义多个变量num1 = num2 = num3 = 3print(num1 , num2 , num3)#交互式赋值...
2022-04-20 12:31:01
268
原创 pygame下载 + 安装 + 为什么安装时会报错解答
如何安装pygame:先下载pygame:一键到达pygame下载区(不要别的,只要一个赞和关注)用 window + R 打开菜单,输入cmd,点击确定,就会有一个黑色的命令窗口出现,输入pip install pygame,如果是苹果电脑,输入pip3 install pygame,回车。如果出现进度条,即为开始安装。如果进度条突然停止,那就重新输入。为什么安装pygame时报错:有人安装pygame时程序报错,这是为什么呢???报错可能是因为:No.1 python版本安.
2022-04-19 17:02:58
8840
2
坦克大战2D--Python
2022-04-19
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人