- 博客(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
261
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
87
原创 我的世界—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
245
原创 我的世界—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
280
原创 我的世界—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
218
原创 我的世界—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
272
原创 我的世界—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
124
原创 我的世界—Python(一)
from __future__ import division import sys import math import random import time from collections import deque from pyglet import image from pyglet.gl import * from pyglet.graphics import TextureGroup from pyglet.window import key, mouse TICKS_PER_SEC =
2022-04-20 17:51:59
313
原创 基础的数字类型(下)
大家好,我是会开灰机的小张!求关 基的数字类型↓ #比较两个数的大小 a3 = 6 a4 = 9 print((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
57
原创 基础数字类型(上)
你我皆MC,身在方块中! 我是会开灰机的小张 这是基础数字类型↓ #导入库 #库:封装一些功能 #math:数学相关的库 #random:生成随机数 import random import math ''' 分类:整数、浮点数、复数 ''' ''' 整数:Python可以处理任意大小的整数,当然包括负整数,在程序中的表示和数学的写法一样。 ''' #连续定义多个变量 num1 = num2 = num3 = 3 print(num1 , num2 , num3) #交互式赋值...
2022-04-20 12:31:01
199
原创 pygame下载 + 安装 + 为什么安装时会报错解答
如何安装pygame: 先下载pygame: 一键到达pygame下载区(不要别的,只要一个赞和关注) 用 window + R 打开菜单,输入cmd,点击确定,就会有一个黑色的命令窗口出现, 输入pip install pygame,如果是苹果电脑,输入pip3 install pygame,回车。如果出现进度条,即为开始安装。如果进度条突然停止,那就重新输入。 为什么安装pygame时报错: 有人安装pygame时程序报错,这是为什么呢??? 报错可能是因为: No.1 python版本安.
2022-04-19 17:02:58
8437
2
坦克大战2D--Python
2022-04-19
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人