五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

添加天空、手和聲音 | Python開發(fā) 我的世界Minecraft

2023-02-10 18:56 作者:xiaotiaotiao2011  | 我要投稿
from ursina import * #導入ursina
from ursina.prefabs.first_person_controller import FirstPersonController
import random

app=Ursina() #創(chuàng)建一個窗口

grass_texture=load_texture('assets/grass_block.png')
stone_texture=load_texture('assets/stone_block.png')
brick_texture=load_texture('assets/brick_block.png')
dirt_texture=load_texture('assets/dirt_block.png')
sky_texture=load_texture('assets/skybox.png')
arm_texture=load_texture('assets/arm_texture.png')
punch_sound=Audio('assets/punch_sound.wav',loop=False,autoplay=False)
block_pick=1

window.fps_counter.enabled=False
window.exit_button.visible=False

def update():
    global  block_pick
    if held_keys['1']: block_pick=1
    if held_keys['2']: block_pick = 2
    if held_keys['3']: block_pick = 3
    if held_keys['4']: block_pick = 4

    if held_keys['left mouse'] or held_keys['right mouse']:
        hand.active()
    else:
        hand.passive()

class Block(Button):
    def __init__(self,position=(0,0,0),texture=grass_texture):
        super().__init__(
            parent=scene,
            position=position,
            model='assets/block',
            origin_y=0.5,
            texture=texture,
            color=color.color(0,0,random.uniform(0.9,1)),
            #highlight_color=color.red,
            scale=0.5
        )

    def input(self,key):
        if self.hovered:
            if key=='left mouse down':
                punch_sound.play()
                if block_pick==1:
                    block=Block(position=self.position+mouse.normal,texture=grass_texture)
                if block_pick==2:
                    block=Block(position=self.position+mouse.normal,texture=stone_texture)
                if block_pick==3:
                    block=Block(position=self.position+mouse.normal,texture=brick_texture)
                if block_pick==4:
                    block=Block(position=self.position+mouse.normal,texture=dirt_texture)

            if key == 'right mouse down':
                punch_sound.play()
                destroy(self)

class Sky(Entity):
    def __init__(self):
        super().__init__(
            parent=scene,
            model='sphere',
            texture=sky_texture,
            scale=random.randrange(200,300),
            double_sided=True
        )

class Hand(Entity):
    def __init__(self):
        super().__init__(
            parent=camera.ui,
            model='assets/arm',
            texture=arm_texture,
            scale=0.2,
            rotation=Vec3(150,-10,0),
            position=Vec2(0.7,-0.58)
        )
    def active(self):
        self.position = Vec2(0.5, -0.53)

    def passive(self):
        self.position = Vec2(0.7, -0.58)


#會生成幾層
for z in range(10):
    for x in range(10):
        for y in range(3):
            block=Block(position=(x,y,z),texture=stone_texture)
for z in range(10):
    for x in range(10):
        for y in range(3):
            block=Block(position=(x,y+3,z),texture=dirt_texture)
for z in range(10):
    for x in range(10):
        block=Block(position=(x,y+4,z))

player=FirstPersonController(x=0,y=100,z=0)
sky=Sky()
hand=Hand()
app.run()


添加天空、手和聲音 | Python開發(fā) 我的世界Minecraft的評論 (共 條)

分享到微博請遵守國家法律
铜鼓县| 郧西县| 尼木县| 临泉县| 贡觉县| 安新县| 南溪县| 张家川| 专栏| 临桂县| 海盐县| 历史| 凤山市| 镶黄旗| 安达市| 宜宾市| 哈巴河县| 三门峡市| 芦山县| 乳源| 望都县| 新源县| 三穗县| 昂仁县| 长宁县| 贺州市| 尖扎县| 安仁县| 望都县| 扎兰屯市| 康定县| 七台河市| 黎城县| 江西省| 二连浩特市| 芮城县| 惠来县| 清涧县| 鸡东县| 府谷县| 崇礼县|