猫史档案馆


【Python作品分享】Ursina-3D游戏1

用户:黄子夏eEGk黄子夏eEGk查看:0 回复:3 评论:0 创建时间:2022-08-12T19:13:23


【作品展示】

center_image

 

【作品介绍】

这是一个用第三方库Ursina做的3D游戏,实现了第一人称操控并创建了一个黄色的方块

 

【作品源代码】

from ursina import *
from ursina.prefabs.first_person_controller \
    import FirstPersonController

app = Ursina()
Sky()
ground = Entity(model="plane",
                texture="grass",
                collider="mesh",
                scale=(200, 200, 200))
block1 = Entity(
    model="cube",
    color=color.yellow,
    texture="white_cube",
    position=(1, 1, 6),
    scale=(5, 5, 5),
    collider="box"
)

player = FirstPersonController()
app.run()

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
小小吃鸡小小吃鸡

imgsrc="https://static.codemao.cn/emoji/codemao/%E7%BC%96%E7%A8%8B%E7%8C%AB_%E5%8E%89%E5%AE%B3%E4%BA%86.gif"alt="emotion_编程猫_厉害了"

点赞0


评论


嗨皮老六嗨皮老六

666

666

666

点赞0


评论


Eternal_BlueEternal_Blue

给个建议,我一般写游戏是像:

class ClassName(Entity):
    def __init__(self,position):
        super().__init__(
            parent=xxx,
            model="xxx",
            texture=xxx,
            color=xxx,
            position=xxx,
            origin_y=xxx
        )

这样来定义实体的,建议这样写代码,更好理解。

点赞0


评论