首页 > 编程语言 >【python】用panda3d实现简易版《Minecraft》

【python】用panda3d实现简易版《Minecraft》

时间:2024-06-13 23:05:18浏览次数:27  
标签:land 1.0 python Minecraft self gree panda3d mode egg

1.下載panda3d等等

          panda3d是python的一个第三方库,在Windows的cmd下输入即可下載:

pip install panda3d

         另外还用了 PIL,Pmw,ttkbootstrap這些第三方库,下載方式同上。。。

2.方块模型

          对于建模小白来说,blender有亿点难!!

 (资源放文章结尾了!)

3.代码编写

    可读性极差,后面注释懒得写了。。。

main.py

​
from direct.showbase.ShowBase import ShowBase
from pandac.PandaModules import WindowProperties
from direct.task import Task
from direct.actor.Actor import Actor
from direct.interval.IntervalGlobal import Sequence
from panda3d.core import *
from panda3d.core import loadPrcFileData
from direct.showbase import DirectObject
from direct.gui.OnscreenText import OnscreenText
from direct.gui.DirectGui import *
from direct.particles.ParticleEffect import ParticleEffect
import random
from Mode_FUNCTION import *
from tkinter import *
from panda3d.core import WindowProperties
from PIL import Image,ImageTk

import math
from panda3d.core import CollisionHandlerPusher

from panda3d.core import CollisionSphere, CollisionNode
from direct.gui.OnscreenImage import OnscreenImage

import ttkbootstrap as ttk
from ttkbootstrap import Style
from ttkbootstrap.constants import *
from panda3d.core import Material
import sys


WORD = open('MAINWORD.txt','r',encoding = 'UTF-8')
MODE = open('WORDMODE.txt','r',encoding = 'UTF-8')

#imageObject = OnscreenImage(image='myImage.jpg', pos=(-0.5, 0, 0.02))

Scale = 18

loadMode_all_list = ["mode//land_gree.egg","mode//glass.egg",\
                     "mode//salt.egg","mode//land.egg",\
                 'mode//oxeye_daisy.egg','mode//Tree_wood.egg',\
                'mode//snow_lend.egg',"mode//grass_Guo.egg",'mode//bedrock.egg'\
                     ,'mode//magma.egg' ,'mode//torch.egg','mode//ice.egg'\
                     ,'mode//water.egg','mode//snow.egg'\
                    ,'mode//Tree_leaves.egg','mode//music.egg']
Mode_all_function = [land_gree,glass,\
                     False,False,grass,\
                     False,False,grass,False\
                     ,magma,torch,False,water,False,False
                     ,music]

MAP_dict = {"mode//land_gree.egg":land_gree,"mode//glass.egg":glass,\
                     "mode//salt.egg":False,"mode//land.egg":False,\
                 'mode//oxeye_daisy.egg':grass,'mode//Tree_wood.egg':False,\
                'mode//snow_lend.egg':False,"mode//grass_Guo.egg":grass,'mode//bedrock.egg':False\
                     ,'mode//magma.egg':magma ,'mode//torch.egg':torch,'mode//ice.egg':False\
                     ,'mode//water.egg':water,'mode//snow.egg':False\
                    ,'mode//Tree_leaves.egg':False,'mode//music.egg':music} 

loadMode_list = []
list_function = []

ima=[]

for i in range(10):
    loadMode_list.append(loadMode_all_list[i])

    list_function.append(Mode_all_function[i])

#print(loadMode_list)

# 重力加速度

GV  = 50
image = []

def add_image(la,image_):
    global image
    image_ = Image.open(image_)
    image_ = image_.resize((30, 30),Image.ANTIALIAS)
    image.append(ImageTk.PhotoImage(image_))
    la.config(image = image[len(image)-1])
def addInstructions2(pos, msg):
    return OnscreenText(text=msg, style=1, fg=(1, 1, 1, 1), scale=.05,
                            shadow=(0, 0, 0, 1), parent=base.a2dTopLeft,
                            pos=(1.2, -pos - 0.04), align=TextNode.ALeft
                            )
def addInstructions(cmr12,pos, msg):
    if cmr12=='':
        return OnscreenText(text=msg, style=1, fg=(1, 1, 1, 1), scale=.05,
                            shadow=(0, 0, 0, 1), parent=base.a2dTopLeft,
                            pos=(0.08, -pos - 0.04), align=TextNode.ALeft
                            )
    else:
        return OnscreenText(text=msg, style=1, fg=(1, 1, 1, 1), scale=.05,
                            shadow=(0, 0, 0, 1), parent=base.a2dTopLeft,
                            pos=(0.08, -pos - 0.04), align=TextNode.ALeft
                            ,font = cmr12)

class MyApp(ShowBase):
        
    def __init__(self):
        ShowBase.__init__(self, windowType = 'none')
        base.startTk()
        style = Style(theme='newtheme')

        self.frame = base.tkRoot
        self.frame.geometry("800x600")

        label = Label(self.frame,relief="flat")
        label.place(relx=0.04, rely=0.05, anchor=CENTER,height = 40 ,width = 40)

        #add_image(label ,'mode\\cool_back.jpg')
        image_ = Image.open('mode\\cool_back.jpg')
        image_ = image_.resize((30, 30),Image.ANTIALIAS)
        label.config(image = ImageTk.PhotoImage(image_))
        
        props = WindowProperties()
        props.set_parent_window(self.frame.winfo_id())
        props.set_origin(0, 0)
        props.set_size(self.frame.winfo_width(), self.frame.winfo_height())

        
        #base.enableParticles()
        #self.p = ParticleEffect()
        #self.p.loadConfig('particles\\fireish.ptf')
        #p.start(parent = render, renderParent = render)

        base.make_default_pipe()
        base.open_default_window(props = props)

        self.frame.bind("<Configure>", self.resize)
        
        cmr12 = self.loader.loadFont('cmr12.egg')
        self.title1 = addInstructions('',1.88,"New word")

        self.title2 = addInstructions(cmr12,1.94,"Panda: my word_1.0")


        myMaterial = Material()
        myMaterial.setShininess(128.0) # Make this material shiny
        myMaterial.setAmbient((0, 0, 1, 1))
        myMaterial.setEmission((0,0,100,100))
        #myMaterial.setSpecular((255,255,255,255))
        

        

        self.key = 0

        
        self.init_h = 3
        self.Camerapos = [0.1,0.1,self.init_h]
        self.Cameramode = True
        self.rotate_speed = 30
        self.up_speed = 380
        self.run_speed = 0.3
        self.rotate_y = 0
        self.rotate_x = 0
        self.dont_run = 0


        self.light_rotate = 135


        self.e_bag = False
        self.esc = True

        self.square_num = 0

        self.fame_bu = Frame(self.frame,bg = '#D3D3D3')
        self.fame_bu.place(relx=0.5, rely=0.96, anchor=CENTER,height = 42 ,width = 412)

        self.la_list = []
        for i in range(10):
            self.la = Label(self.fame_bu,relief="flat")
            self.la.place(x=i*41+1,y=1,height = 40 ,width = 40)
            self.la_list.append(self.la)

        e = 0
        for i in loadMode_list:
            
            add_image(self.la_list[e] ,i+'.png')
            e += 1

        self.la_list[self.square_num].config(relief="solid")

        # 初速度
        self.V = 0

        self.win.setClearColor((0.2549, 0.41176, 0.88235, 0))

        #ambientLight = AmbientLight("ambientLight")
      #  ambientLight.setColor((.3, .3, .3, 1))
     #   directionalLight = DirectionalLight("directionalLight")
     #   directionalLight.setDirection((-5, -5, -5))
     #   directionalLight.setColor((1, 1, 1, 1))
     #   directionalLight.setSpecularColor((1, 1, 1, 1))
     #   render.setLight(render.attachNewNode(ambientLight))
     #   render.setLight(render.attachNewNode(directionalLight))
        #plight = PointLight('plight')
        #plight.setColor((0.2, 0.2, 0.2, 2))
        #plight.attenuation = (0, 0, 0.00001)
       # plnp = render.attachNewNode(plight)
       # plnp.setPos(0, 0, 100)
       # render.setLight(plnp)

        alight = AmbientLight('alight')
        alight.setColor((0.1, 0.1, 0.1, 0.1))
        alnp = render.attachNewNode(alight)
        #render.setLight(alnp)

        self.alight = render.attachNewNode(AmbientLight("Ambient"))
        self.alight.node().setColor(LVector4(0.7, 0.7, 0.7, 0.4))
        render.setLight(self.alight)

        # Important! Enable the shader generator.
        render.setShaderAuto()



        #alight.setShadowCaster(True, 512, 512)
        #plight.setShadowCaster(True, 512, 512)
        #render.setShaderAuto()

        # 显示碰撞物体

        # 添加为活跃对象

        self.camera.setPos(self.Camerapos[0] ,self.Camerapos[1] ,self.Camerapos[2])
        
        #scene = loader.loadModel("mode//env.egg.pz")

        #scene.reparentTo(render)
        #scene.setScale(1000, 1000, 1000)
        #scene.setPos(0, 0, -1.99)

        #self.cleck = loader.loadModel("mode//ice.egg")

        #self.cleck.reparentTo(render)
        #self.cleck.setScale(1.01, 1.01, 1.01)
        #self.cleck.setPos(0, 0, 6)


        self.cleck = loader.loadModel("mode//cleck_cool.egg")

        self.cleck.reparentTo(render)
        self.cleck.setScale(0.51, 0.51, 0.51)
        self.cleck.setPos(0, 0, -4)
        z = -1

        
        self.cTravTwo = CollisionTraverser()
        self.cTravTwo.setRespectPrevTransform(True)
        #self.me = loader.loadModel("mode//steve.egg")

        #self.me.reparentTo(render)
        #self.me.setScale(0.5,0.5, 0.5) 
        #self.me.setPos(0, 0, 0)
        #s=1.3
        self.camGroundRay = CollisionRay()
        #self.camGroundRay.setRespectPrevTransform(True)
        self.camGroundRay.setOrigin(0, 0, 9)
        self.camGroundRay.setDirection(0, 0, -1)
       # self.camGroundRay1 = CollisionRay()
       # self.camGroundRay1.setOrigin(-s, s, 9)
       # self.camGroundRay1.setDirection(0, 0, -1)
       # self.camGroundRay2 = CollisionRay()
      #  self.camGroundRay2.setOrigin(s, -s, 9)
       # self.camGroundRay2.setDirection(0, 0, -1)
       # self.camGroundRay3 = CollisionRay()
      #  self.camGroundRay3.setOrigin(-s, -s, 9)
      #  self.camGroundRay3.setDirection(0, 0, -1)
      #  self.camGroundRay4 = CollisionRay()
      #  self.camGroundRay4.setOrigin(0, 0, 9)
      #  self.camGroundRay4.setDirection(0, 0, -1)
        self.ralphGroundHandler_two = CollisionHandlerQueue()
        self.camGroundCol = CollisionNode('camRay')

        #Collision_listi = [[-0.9*s,0.8*s],[-0.7*s,0.8*s],[0.7*s,0.8*s],[0.9*s,0.8*s],[-0.9*s,-2.2*s],\
        #                   [-0.6*s,-2.2*s],[0.6*s,-2.2*s],[0.9*s,-2.2*s],[0.6*s,0.6*s],\
        #                   [-0.6*s,0.6*s],[0.6*s,-0.6*s],[-0.6*s,-0.6*s],[0,-0.6*s],[0,0.6*s]]
        Collision_listii = []
        Collision_listi = [[1.2,1.2],[1,-1.2],[-1.2,1.2],[-1.2,-1.2],\
                           [0,1.2],[1.2,0],[-1.2,0],[0,-1.2],[0,0],\
                           [1.2,0.6],[0.6,1,2],[1.2,-0.6],[0.6,-1.2],\
                           [-1.2,0.6],[-0.6,1,2],[-1.2,-0.6],[-0.6,-1.2]]
        
        for i in Collision_listi:
            self.camGroundRay = CollisionRay()
            self.camGroundRay.setOrigin(i[0], i[1], 9)
            self.camGroundRay.setDirection(0, 0, -1)
            self.camGroundCol.addSolid(self.camGroundRay)
        self.camGroundCol.addSolid(self.camGroundRay)
        self.camGroundCol.setFromCollideMask(GeomNode.getDefaultCollideMask())
                
        self.me = Actor("mode/steve.egg",
                           {"run": "models/steve_run.egg"})
        
        #self.me = loader.loadModel("mode//steve.egg")

        self.me.reparentTo(render)
        self.me.setScale(0.4, 0.4, 0.4)
        self.me.setPos(0, 0, 0)
        self.me.setTwoSided(False)
        self.me.hide()
        self.me.setTag('myObjectTag','me')

        
        self.scene1 = loader.loadModel("env.egg.pz")

        self.scene1.reparentTo(render)
        self.scene1.setTwoSided(True)
        self.scene1.setShaderAuto()
        self.scene1.setScale(600, 600, 600)
        self.scene1.setPos(0, 0, -160.99)
        #self.me.loop("
        self.light = render.attachNewNode(Spotlight("Spot"))
        #self.light.node().setScene(render)
        self.light.node().setShadowCaster(True)
        self.light.setPos(0,-30,1)
        self.light.setHpr(0,self.light_rotate,0)
        self.light.node().showFrustum()
        self.light.node().getLens().setFov(40)
        self.light.node().getLens().setNearFar(10, 100)
        render.setLight(self.light)
        #lens = PerspectiveLens()
        #self.light.setLens(lens)
        #self.slnp = render.attachNewNode(self.light)
        #self.slnp.node().setShadowCaster(True)
        #self.slnp.node().getLens().setFov(40)
        #self.slnp.node().getLens().setNearFar(10, 100)
        #self.slnp.setPos(10, 20, 0)
        #slnp.lookAt(myObject)

        
        self.camGroundColNp = self.me.attachNewNode(self.camGroundCol)
        #self.camGroundHandler = CollisionRay()

        self.cTravTwo.addCollider(self.camGroundColNp, self.ralphGroundHandler_two)
        self.camGroundColNp.show()
        #self.cTravTwo.showCollisions(render)

        #self.plightw = PointLight('plight')
        #self.plightw.setColor((205, 98, 55, 2))
        #self.plightw.attenuation = (0, 0, 5)
        #self.plnp = render.attachNewNode(self.plightw)
        #self.plnp.setPos(5, 5, 3)
        #self.plightw.setShadowCaster(True)
        #self.plightw.showFrustum()
        #self.render.setLight(self.plnp)

        
        self.cTrav = CollisionTraverser()
        self.scene_mode = []
        self.scene_list = []
        self.pos_list = []
        self.scene_Funstion = {}
        self.ralphGroundCol = CollisionNode('ralphRay')
        self.ralphGroundRay = CollisionRay()
        self.ralphGroundRay.setOrigin(0.5, 0.5, 9)
        self.ralphGroundRay.setDirection(0, 0, -1)
        #self.ralphGroundRay1 = CollisionRay()
        #self.ralphGroundRay1.setOrigin(-0.5, 0.5, 9)
        #self.ralphGroundRay1.setDirection(0.5, 0.5, -1)
        #self.ralphGroundRay2 = CollisionRay()
        #self.ralphGroundRay2.setOrigin(0.5, -0.5, 9)
        #self.ralphGroundRay2.setDirection(0, 0, -1)
        #self.ralphGroundRay3 = CollisionRay()
        #self.ralphGroundRay3.setOrigin(-0.5, -0.5, 9)
        #self.ralphGroundRay3.setDirection(0, 0, -1)
        #self.ralphGroundRay = CollisionPolygon(Point3(0, 0, 0), Point3(0, 0, 1),
                        #Point3(0, 1, 1), Point3(0, 1, 0))
        self.ralphGroundCol.addSolid(self.ralphGroundRay)
        #self.ralphGroundCol.addSolid(self.ralphGroundRay1)
        #self.ralphGroundCol.addSolid(self.ralphGroundRay2)
        #self.ralphGroundCol.addSolid(self.ralphGroundRay3)
        self.ralphGroundCol.setFromCollideMask(CollideMask.bit(0))
        self.ralphGroundCol.setIntoCollideMask(CollideMask.allOff())

        l = list(WORD)
        m = list(MODE)
        for e,i in enumerate(l):
            x = float(i[:i.find('*')])
            i = i[i.find('*')+1:]
            y = float(i[:i.find('*')])
            z = float(i[i.find('*')+1:])
            m[e] = m[e][:-1]
            self.add_scene = loader.loadModel(m[e])
            self.add_scene.setMaterial(myMaterial)
            self.add_scene.setShaderAuto()

            if MAP_dict[m[e]]:
                function_ = MAP_dict[m[e]]()
                self.add_scene.setTwoSided(function_.setTwoSided)
                if function_.Run:
                    function_.Run_(self,x, y, z)
                if function_.Scale:
                    self.add_scene.setScale(function_.Scale[0], \
                            function_.Scale[1],function_.Scale[2])
                else:
                    self.add_scene.setScale(0.4999, 0.4999, 0.4999)
                            
                if function_.pos:
                    self.add_scene.setPos(x + function_.pos[0], \
                            y +  function_.pos[1], \
                                z +  function_.pos[2])
                            #print(i[0] + list_function[self.square_num].pos[0], \
                                #  i[1] +  list_function[self.square_num].pos[1], \
                                 #       i[2] +  list_function[self.square_num].pos[2])
                else:
                    self.add_scene.setPos(x, y, z)
            else:
                function_ = MAP_dict[m[e]]
                self.add_scene.setScale(0.4999, 0.4999, 0.4999)
                self.add_scene.setPos(x, y, z)



            self.add_scene.setShaderAuto()

            self.add_scene.reparentTo(render)
            self.add_scene.setTag('myObjectTag', str(float(x))+','+str(float(y))+','+str(float(z)))

            self.ralphGroundColNp = self.add_scene.attachNewNode(self.ralphGroundCol)
            self.ralphGroundHandler = CollisionHandlerQueue()
                    #scene.setTag('myObjectTag',str(x)+','+str(y)+','+str(z))#str(x)+','+str(y)+','+str(z)
            self.cTrav.addCollider(self.ralphGroundColNp, self.ralphGroundHandler)

            self.cTravTwo.addCollider(self.ralphGroundColNp, self.ralphGroundHandler_two)

            ### 切记核心 scene_mode种类 post_list 位置
            self.scene_mode.append(m[e])
            self.scene_list.append(self.add_scene)
            self.pos_list.append([float(x), float(y), float(z)])
            self.scene_Funstion[str(float(x))+','+str(float(y))+','+str(float(z))] = function_




        render.setShaderAuto()        

                #self.ralphGroundColNp.show()
###########

##########

        self.pickerNode = CollisionNode('mouseRay')
        self.pickerNP = self.camera.attachNewNode(self.pickerNode)
        self.pickerNode.setFromCollideMask(GeomNode.getDefaultCollideMask())
        self.pickerRay = CollisionRay()
        self.pickerNode.addSolid(self.pickerRay)
        self.cTrav.addCollider(self.pickerNP, self.ralphGroundHandler)


        
        self.keyMap = {'w':False,'s':False,'a':False,'d':False,'f':False}
        self.accept( 'w-up' , self.app_key,['w',False])
        self.accept( 's-up' , self.app_key,['s',False])
        self.accept( 'a-up' , self.app_key,['a',False])
        self.accept( 'd-up' , self.app_key,['d',False])
        self.accept( 'f-up' , self.app_key,['f',False])
        self.accept( 'f' , self.app_key,['f',True])
        self.accept( 'w' , self.app_key,['w',True])
        self.accept( 's' , self.app_key,['s',True])
        self.accept( 'a' , self.app_key,['a',True])
        self.accept( 'd' , self.app_key,['d',True])

        self.accept( 'e' , self.app_e_down)
        self.accept( 'escape' , self.app_esc_down)
        
        self.accept( 'f1' , self.app_View)
        self.accept( 'space' , self.backspace)
        self.accept( 'p' , self.save)
        
        self.accept( '0' , self.app_num,[0])
        self.accept( '1' , self.app_num,[1])
        self.accept( '2' , self.app_num,[2])
        self.accept( '3' , self.app_num,[3])
        self.accept( '4' , self.app_num,[4])
        self.accept( '5' , self.app_num,[5])
        self.accept( '6' , self.app_num,[6])
        self.accept( '7' , self.app_num,[7])
        self.accept( '8' , self.app_num,[8])
        self.accept( '9' , self.app_num,[9])

        self.accept( 'mouse1' , self.app_mouse,[True])
        self.accept( 'mouse3' , self.app_mouse,[False])

        

        #in = {'1':loader.loadModel("mode//land_gree.egg"),
        #'2': loader.loadModel("mode//land_gree.egg"}

        #self.square_dict = {}




        dr = self.win.makeDisplayRegion()
        dr.sort = 0

        myCamera2d = NodePath(Camera('myCam2d'))
        lens = OrthographicLens()
        lens.setFilmSize(2, 2)
        lens.setNearFar(-1000, 1000)
        myCamera2d.node().setLens(lens)
        
        myRender2d = NodePath('myRender2d')
        myRender2d.setDepthTest(False)
        myRender2d.setDepthWrite(False)
        myCamera2d.reparentTo(myRender2d)
        dr.setCamera(myCamera2d)
        
        aspectRatio = base.getAspectRatio()
        myAspect2d = myRender2d.attachNewNode(PGTop('myAspect2d'))
        myAspect2d.setScale(2.0 / aspectRatio, 2.0, 2.0)
        myAspect2d.node().setMouseWatcher(base.mouseWatcherNode)

        #self.text=OnscreenText(fg=(255,255,255,255),pos=(-0.9,0.9),scale=0.1,mayChange=True)

        X1=DirectFrame(frameColor=(255,255,255,255),frameSize=(-0.04,0.04,-0.002,0.002),pos=(0,0,0))
        X2=DirectFrame(frameColor=(255,255,255,255),frameSize=(-0.002,0.002,-0.04,0.04),pos=(0,0,0))
        self.taskMgr.add(self.appdown, "appdown")
        self.taskMgr.add(self.find_Collision, "appdown")

    def save(self):
        s = ''
        for i in self.pos_list:
            x = str(i[0]) + '*' + str(i[1]) + '*' + str(i[2])

            s = s + x + '\n'
        s = s[:-1]
        p = ''
        for i in self.scene_mode:
            p = p + i + '\n'

        print(p,s)
        
        
        f=open('WORDMODE.txt','w')
        f.write(p)
        f=open('MAINWORD.txt','w')
        f.write(s)

    def app_e_down(self):
        global ima
        if self.e_bag:
            self.e_bag = False
            self.fame_bag.destroy()

        else:
            self.e_bag = True
            self.fame_bag = Canvas(self.frame,bg = '#D3D3D3')
            self.fame_bag.place(relx=0.5, rely=0.5, anchor=CENTER,height = 400 ,width = 545)

            x=5
            y=25
            e=0
            for L in loadMode_all_list:
                ima_ = Image.open(L+'.png')
                ima_ = ima_.resize((30, 30))
                ima.append(ImageTk.PhotoImage(ima_))             
                la = Label( image = ima[-1])
                self.fame_bag.create_window((x, y),window=la,anchor='w',height=40,width=40)
                la.bind('<Button-1>',lambda but = Mode_all_function[e],massage = [L,Mode_all_function[e]], : self.button(but,massage))
                print(L,Mode_all_function[e])
                if x == 500:
                    x = 5
                    y += 45
                else:
                    x += 45
                e+=1
                    
    def button(self,b,t):
        global key,image
        loadMode_list[self.key] = t[0]
        list_function[self.key] = t[1]

        image_ = Image.open(t[0]+'.png')
        image_ = image_.resize((30, 30))
        image_ = ImageTk.PhotoImage(image_)
        image[self.key] = image_

        self.la_list[self.key].config(image = image[self.key])
            
            
    def app_esc_down(self):
        if self.esc:
            self.esc = False

        else:
            self.esc = True
            
    def resize(self, event):
        props = WindowProperties()
        props.set_origin(0, 0)
        props.set_size(self.frame.winfo_width(), self.frame.winfo_height())
        base.win.request_properties(props)
        
    def backspace(self):
        
        self.V = -self.up_speed 
        print(1)
    def app_num(self, key):
        print(key)
        self.key = key
        self.square_num = key

        for i in self.la_list:
            i.config(relief="flat")

        self.title1['text'] = loadMode_list[self.square_num]


        self.la_list[self.square_num].config(relief="solid")

        
    def app_View(self):
        if self.Cameramode:
            self.Cameramode = False
            self.me.show()
        else:
            self.Cameramode = True
            self.me.hide()
        
    def app_mouse(self,num):
        if num:
            self.myFunction()
        else:
            self.myFunction3()

    def app_key(self, key, value):  
        self.keyMap[key] = value

    def find_Collision(self,task):
        #try:
        #0  1 前 2 后 3 ← 4 右
        t = 0.9
        self.dont_run = []
        self.G_down = True
        self.cTravTwo.traverse(render)
        #print(self.ralphGroundHandler_two.getNumEntries())
        if self.ralphGroundHandler_two.getNumEntries() > 0:
            self.ralphGroundHandler_two.sortEntries()
            for e in range(self.ralphGroundHandler_two.getNumEntries()):
                #print(self.ralphGroundHandler_two.getEntry(e).getIntoNodePath())
                try:
                    pickedObj = self.ralphGroundHandler_two.getEntry(e).getIntoNodePath()
                    index = pickedObj.getNetTag('myObjectTag')
                    pickedObj = pickedObj.getNetTag('myObjectTag')
                    x = float(pickedObj[:pickedObj.index(',')])
                    pickedObj = pickedObj[pickedObj.index(',')+1:]
                    y = float(pickedObj[:pickedObj.index(',')])
                    pickedObj = pickedObj[pickedObj.index(',')+1:]
                    z = float(pickedObj)
                    #print(self.ralphGroundHandler_two.getEntry(e).getIntoNodePath())
                    #print(self.Camerapos[0])
                    #print(float((self.Camerapos[0]//1 + math.ceil(self.Camerapos[0]))/2) ,x)
                    #print(z)
                    if self.Camerapos[0]//1 == math.ceil(self.Camerapos[0]):
                        if self.Camerapos[0]>=0:
                            index_x = self.Camerapos[0] + 0.5
                        else:
                            index_x = self.Camerapos[0] - 0.5
                    else:
                        index_x = float((self.Camerapos[0]//1 + math.ceil(self.Camerapos[0]))/2)
                    if self.Camerapos[1]//1 == math.ceil(self.Camerapos[1]):
                        if self.Camerapos[1]>=0:
                            index_y = self.Camerapos[1] + 0.5
                        else:
                            index_y = self.Camerapos[1] - 0.5
                    else:
                        index_y = float((self.Camerapos[1]//1 + math.ceil(self.Camerapos[1]))/2)
                    #print(index_x,index_y)
                    if  index_x == x and index_y == y :
                        if z + 0.5 >= self.Camerapos[2] - self.init_h > z - 0.5:
                            if self.scene_Funstion[index]:
                                if self.scene_Funstion[index].can_collision:
                                    print(11)
                                else:
                                    self.G_down = False
                                    #self.V -= GV
                                    self.Camerapos[2] = z + self.init_h + 0.5
                            else:
                                self.G_down = False
                                #self.V -= GV
                                self.Camerapos[2] = z + self.init_h + 0.5          
                        #else:
                    #print(self.ralphGroundHandler_two.getEntry(e).getIntoNodePath())
                    if self.scene_Funstion[index]:
                        if self.scene_Funstion[index].can_collision:
                            continue
                        else:
                            pass
                    else:
                        pass
                    if self.Camerapos[2]-0.5 > z > self.Camerapos[2] - self.init_h:
                        self.dont_run = []
                        #print(111)
                        #if self.Camerapos[1] == y - t or self.Camerapos[1] == y + t\
                         #                      or self.Camerapos[0] == x + t or\
                         #                      self.Camerapos[0] == x - t:
                         #   t += 0.1
                        #else:
                         #   t = 0.9
                        if self.Camerapos[1]-y == 0:
                            if self.Camerapos[0]-x >= 0:
                                self.dont_run.append(3)
                                if self.Camerapos[1] >= y - t:
                                    self.Camerapos[1] = y - t
                            else:
                                self.dont_run.append(4)
                                if self.Camerapos[1] <= y + t:
                                    self.Camerapos[1] = y + t
                        else:
                            tan = (self.Camerapos[0]-x)/(self.Camerapos[1]-y)
                            #print(tan,self.Camerapos[0],x,self.Camerapos[0]-x)
                            if tan>1 or tan<-1:
                                if self.Camerapos[0]-x>0:
                                    self.dont_run.append(3)
                                    if self.Camerapos[0] <= x + t:
                                        self.Camerapos[0] = x + t
                                if self.Camerapos[0]-x<0:
                                    self.dont_run.append(4)
                                    if self.Camerapos[0] >= x - t:
                                        self.Camerapos[0] = x - t
                            elif -1<tan<1 and self.Camerapos[1]-y>0:
                                self.dont_run.append(1)
                                if self.Camerapos[1] <= y + t:
                                    self.Camerapos[1] = y + t
                            elif -1<tan<1 and self.Camerapos[1]-y<0:
                                self.dont_run.append(2)
                                if self.Camerapos[1] >= y - t:
                                    self.Camerapos[1] = y - t
                            elif tan==1  and self.Camerapos[0]-x>=0:
                                self.dont_run = 31
                                if self.Camerapos[1] <= y + t:
                                    self.Camerapos[1] = y + t
                            elif tan==-1  and self.Camerapos[0]-x>=0:
                                self.dont_run.append(2)
                                self.dont_run.append(3)
                                if self.Camerapos[0] <= x + t:
                                    self.Camerapos[0] = x + t
                                if self.Camerapos[1] >= y - t:
                                    self.Camerapos[1] = y - t

                            elif tan==1 and self.Camerapos[0]-x<0:
                                self.dont_run.append(2)
                                self.dont_run.append(4)
                                if self.Camerapos[0] >= x - t:
                                    self.Camerapos[0] = x - t
                                if self.Camerapos[1] >= y - t:
                                    self.Camerapos[1] = y - t
                            elif tan==-1 and self.Camerapos[0]-x<0:
                                self.dont_run.append(1)
                                self.dont_run.append(4)
                                if self.Camerapos[0] >= x - t:
                                    self.Camerapos[0] = x - t
                                if self.Camerapos[1] <= y + t:
                                    self.Camerapos[1] = y + t
                            if tan == 1 or tan == -1:
                                print(111)
                                        


                                #print(z)

                        #if z<= self.Camerapos[2]:
                        #print(1)
                        #self.G_down = False
                        #self.V = 0
                except:
                    pass
        if self.G_down or self.V<0:
            #self.V=0
            self.G_run()
        else:
            self.V=0
        #if self.V<0:
            #self.G_run()
            #pass
            
        return task.cont
    
    def appdown(self,task):
        if self.Cameramode:
            if self.keyMap['f']:
                run_speed = 2*self.run_speed
            else:
                run_speed = self.run_speed
            run_x,run_y = self.Camerarun(True,-2.4*run_speed)
            self.camera.setFluidPos(self.Camerapos[0] +run_x,self.Camerapos[1] +run_y ,self.Camerapos[2]-1.2)
            self.me.setFluidPos(self.Camerapos[0] ,self.Camerapos[1] ,self.Camerapos[2]-3.2)
        else:
            if self.keyMap['f']:
                run_speed = 1.8*self.run_speed
            else:
                run_speed = self.run_speed
            #print(self.rotate_y)
            a = (-math.sin(((self.rotate_y)/180)*math.pi)*10+10)*5
            h = 9-math.cos(((self.rotate_y)/180)*math.pi)*5
            run_x,run_y = self.Camerarun(True,-run_speed)
            self.camera.setFluidPos(self.Camerapos[0]+run_x*a ,self.Camerapos[1]+run_y*a ,self.Camerapos[2]+h)
            self.me.setFluidPos(self.Camerapos[0] ,self.Camerapos[1] ,self.Camerapos[2]-3.2)
        #self.text['text'] = 'pos: X= ' + str(int(self.Camerapos[0])) +',Y = '+ str(int(self.Camerapos[1])) + ',Z = ' + str(int(self.Camerapos[2]))
      #self.light.setPos(1,1, 2)
        if self.keyMap['f']:
            run_speed = 1.8*self.run_speed
        else:
            run_speed = self.run_speed
            
        if self.keyMap['w']:
            x,y = self.Camerarun(True,run_speed)
            self.add_run(x,y)
        if self.keyMap['s']:
            x,y = self.Camerarun(True,-run_speed)
            self.add_run(x,y)
        if self.keyMap['a']:
            x,y = self.Camerarun(False,-run_speed)
            self.add_run(x,y)
            #Camerapos
        if self.keyMap['d']:
            x,y = self.Camerarun(False,run_speed)
            self.add_run(x,y)
            #Camerapos
        if self.esc or self.e_bag:
            self.disableMouse()
            props = WindowProperties()
            props.setCursorHidden(False)
            props.setMouseMode(WindowProperties.M_relative)
            self.win.requestProperties(props)
            
            if self.mouseWatcherNode.hasMouse():
                self.rotate_x = self.mouseWatcherNode.getMouseX()*self.rotate_speed
                self.rotate_y = self.mouseWatcherNode.getMouseY()*self.rotate_speed
        else:
            self.disableMouse()
            props = WindowProperties()
            props.setCursorHidden(True)
            props.setMouseMode(WindowProperties.M_relative)
            self.win.requestProperties(props)

            mw = self.mouseWatcherNode
            if mw.hasMouse():
                self.rotate_x -= mw.getMouseX()*self.rotate_speed
                self.un_rotate_y = -1
                if self.rotate_y>90:
                    self.un_rotate_y = True
                elif self.rotate_y<-90:
                    self.un_rotate_y = False
                if mw.getMouseY()<=0 and self.un_rotate_y:
                    self.rotate_y += mw.getMouseY()*self.rotate_speed
                if mw.getMouseY()>=0 and not self.un_rotate_y:
                    self.rotate_y += mw.getMouseY()*self.rotate_speed
                if self.un_rotate_y == -1:
                    self.rotate_y += mw.getMouseY()*self.rotate_speed
                

                props = self.win.getProperties()
                base.win.movePointer(0,
                                     props.getXSize() // 2,
                                     props.getYSize() // 2)
        self.myFunction2()

        #self.G_run()
            
        self.camera.setHpr(self.rotate_x,self.rotate_y,0)
        self.me.setH(180+self.rotate_x)
        return task.cont
    
    def G_run(self):
        self.V += GV

        self.Camerapos[2] -= self.V/1000
    
    def myFunction3(self):
        try:
            if self.mouseWatcherNode.hasMouse():
                mpos = self.mouseWatcherNode.getMouse()

            self.pickerRay.setFromLens(self.camNode, mpos.x, mpos.y)
            mpos = base.mouseWatcherNode.getMouse()
            self.pickerRay.setFromLens(self.camNode, mpos.getX(), mpos.getY())

            self.cTrav.traverse(render)
            if self.ralphGroundHandler.getNumEntries() > 0:
                self.ralphGroundHandler.sortEntries()
                pickedObj = self.ralphGroundHandler.getEntry(0).getIntoNodePath()
                pickedObj = pickedObj.getNetTag('myObjectTag')
            x = float(pickedObj[:pickedObj.index(',')])
            pickedObj = pickedObj[pickedObj.index(',')+1:]
            y = float(pickedObj[:pickedObj.index(',')])
            pickedObj = pickedObj[pickedObj.index(',')+1:]
            z = float(pickedObj)

            mode_pos = [[x,y,z+1],[x+1,y,z],[x,y+1,z],[x-1,y,z],[x,y-1,z],[x,y,z-1]]

            for i in mode_pos:
                if i in self.pos_list:
                    pass
                else:
                    #print(self.square_num,self.square_dict)
                    self.add_scene = loader.loadModel(loadMode_list[self.square_num])
                    #self.add_scene.setMaterial(myMaterial)
                    #self.add_scene.setShaderAuto()
                    self.add_scene.reparentTo(render)
                    #print(list_function,self.square_num)
                    render.setShaderAuto()
                    if list_function[self.square_num]:
                        function_ = list_function[self.square_num]()
                        self.add_scene.setTwoSided(function_.setTwoSided)
                        if function_.Run:
                            function_.Run_(self,i[0], i[1], i[2])
                        if function_.Scale:
                            self.add_scene.setScale(function_.Scale[0], \
                                   function_.Scale[1],function_.Scale[2])
                        else:
                            self.add_scene.setScale(0.4999, 0.4999, 0.4999)
                            
                        if function_.pos:
                            self.add_scene.setPos(i[0] + function_.pos[0], \
                                  i[1] +  function_.pos[1], \
                                        i[2] +  function_.pos[2])
                            #print(i[0] + list_function[self.square_num].pos[0], \
                                #  i[1] +  list_function[self.square_num].pos[1], \
                                 #       i[2] +  list_function[self.square_num].pos[2])
                        else:
                            self.add_scene.setPos(i[0], i[1], i[2])
                    else:
                        function_ = list_function[self.square_num]
                        self.add_scene.setScale(0.4999, 0.4999, 0.4999)
                        self.add_scene.setPos(i[0], i[1], i[2])
                    self.add_scene.setTag('myObjectTag', str(i[0])+','+str(i[1])+','+str(i[2]))
                    #scene.scene.setPos(i[0], i[1], i[2])
                    #print(self.add_scene.getPos())
                    self.ralphGroundColNp = self.add_scene.attachNewNode(self.ralphGroundCol)
                    self.ralphGroundHandler = CollisionHandlerQueue()
                    self.cTrav.addCollider(self.ralphGroundColNp, self.ralphGroundHandler)

                    self.cTrav.addCollider(self.pickerNP, self.ralphGroundHandler)
                    
                    if self.mouseWatcherNode.hasMouse():
                        mpos = self.mouseWatcherNode.getMouse()

                    self.pickerRay.setFromLens(self.camNode, mpos.x, mpos.y)
                    mpos = base.mouseWatcherNode.getMouse()
                    self.pickerRay.setFromLens(self.camNode, mpos.getX(), mpos.getY())

                    self.cTrav.traverse(render)
                    if self.ralphGroundHandler.getNumEntries() > 0:
                        self.ralphGroundHandler.sortEntries()
                        pickedObj = self.ralphGroundHandler.getEntry(0).getIntoNodePath()
                        pickedObj = pickedObj.getNetTag('myObjectTag')
                    if pickedObj == str(float(i[0]))+','+str(float(i[1]))+','+str(float(i[2])):
                        self.scene_list.append(self.add_scene)
                        self.pos_list.append([float(i[0]), float(i[1]), float(i[2])])
                        self.scene_Funstion[str(float(i[0]))+','+str(float(i[1]))+','+str(float(i[2]))] = function_
                        self.scene_mode.append(loadMode_list[self.square_num])
                        print(len(self.scene_mode),len(self.pos_list))
                        print(2)
                    else:
                        
                        if function_:
                            #print(list_function[self.square_num].pos)
                            if function_.Run:
                                function_.Del_(self)
                        
                        self.add_scene.removeNode()
                        self.ralphGroundColNp.removeNode()
        except:
            pass
    
    def myFunction2(self):
        try:
            if self.mouseWatcherNode.hasMouse():
                mpos = self.mouseWatcherNode.getMouse()

            self.pickerRay.setFromLens(self.camNode, mpos.x, mpos.y)
            mpos = base.mouseWatcherNode.getMouse()
            self.pickerRay.setFromLens(self.camNode, mpos.getX(), mpos.getY())

            self.cTrav.traverse(render)
            # Assume for simplicity's sake that myHandler is a CollisionHandlerQueue.
            if self.ralphGroundHandler.getNumEntries() > 0:
                #print(self.ralphGroundHandler.getNumEntries())
                # This is so we get the closest object
                self.ralphGroundHandler.sortEntries()
                pickedObj = self.ralphGroundHandler.getEntry(0).getIntoNodePath()
                pickedObj = pickedObj.getNetTag('myObjectTag')
                if pickedObj == 'me':
                    pickedObj = self.ralphGroundHandler.getEntry(1).getIntoNodePath()
                    pickedObj = pickedObj.getNetTag('myObjectTag')
                    
                x = pickedObj[:pickedObj.index(',')]
                pickedObj = pickedObj[pickedObj.index(',')+1:]
                y = pickedObj[:pickedObj.index(',')]
                pickedObj = pickedObj[pickedObj.index(',')+1:]
                z = pickedObj
                self.cleck.setPos(float(x),float(y),float(z))
        except:
            pass
            
    def myFunction(self):
        if self.mouseWatcherNode.hasMouse():
            mpos = self.mouseWatcherNode.getMouse()

        self.pickerRay.setFromLens(self.camNode, mpos.x, mpos.y)
        mpos = base.mouseWatcherNode.getMouse()
        self.pickerRay.setFromLens(self.camNode, mpos.getX(), mpos.getY())

        self.cTrav.traverse(render)
        if self.ralphGroundHandler.getNumEntries() > 0:
            self.ralphGroundHandler.sortEntries()
            pickedObj = self.ralphGroundHandler.getEntry(0).getIntoNodePath()
            if pickedObj.findNetTag('myObjectTag'):
                for e,i in enumerate(self.pos_list):
                    if pickedObj.getNetTag('myObjectTag') == str(i[0])+','+str(i[1])+','+str(i[2]):
                        if self.scene_Funstion[str(i[0])+','+str(i[1])+','+str(i[2])]:
                            if self.scene_Funstion[str(i[0])+','+str(i[1])+','+str(i[2])].Run:
                                self.scene_Funstion[str(i[0])+','+str(i[1])+','+str(i[2])].Del_(self)
                        del self.pos_list[e]
                        del self.scene_list[e]
                        del self.scene_mode[e]
                        del self.scene_Funstion[str(i[0])+','+str(i[1])+','+str(i[2])]
                        print(1)
                pickedObj.removeNode()
    
    def Camerarun(self,rotate,speed):
        pi_rotate = (self.rotate_x/180)*math.pi
        if rotate:
            add_runx = -math.sin(pi_rotate)*speed
            add_runy = math.cos(pi_rotate)*speed
        else:
            speed = speed*0.8
            add_runx = math.cos(pi_rotate)*speed
            add_runy = math.sin(pi_rotate)*speed
            
            
        return add_runx,add_runy

        #self.camera.setPos(self.Camerapos[0] ,self.Camerapos[1] ,self.Camerapos[2])
        #self.me.setPos(self.Camerapos[0] ,self.Camerapos[1] ,self.Camerapos[2]-3.5)        

    def add_run(self,add_runx,add_runy):
        self.light.setPos(self.Camerapos[0],self.Camerapos[1]-30, 2)
        self.light.setHpr(0,self.light_rotate,0)
        #print(self.dont_run)
        if self.dont_run == []:
            pass
        if 1 in self.dont_run:
            if add_runy<=0:
                add_runy = 0
         
        if 2 in self.dont_run:
            if add_runy>=0:
                add_runy = 0
            
        if 3 in self.dont_run:
            if add_runx<=0:
                add_runx = 0
            
        if 4 in self.dont_run:
            if add_runx>=0:
                add_runx = 0

        
                
        self.Camerapos[0] += add_runx
        self.Camerapos[1] += add_runy
            
  
a = MyApp()
a.run()


​

Mode_FUNCTION.py

from direct.showbase.ShowBase import ShowBase
from math import pi, sin, cos
from pandac.PandaModules import WindowProperties
from direct.task import Task
from direct.actor.Actor import Actor
from direct.interval.IntervalGlobal import Sequence
from panda3d.core import *
from panda3d.core import loadPrcFileData
from direct.showbase import DirectObject
import random


class magma():
    def __init__(self):
        self.setTwoSided = False
        self.Run = True
        self.can_collision = True
        self.Scale = False
        self.pos = False
        self.disremove = False
        self.reflection = False
        
    def Run_(self,main_app,x,y,z):
        self.plight = PointLight('plight')
        self.plight.setColor((205, 98, 55, 2))
        self.plight.attenuation = (0, 0, 250)
        self.plnp = render.attachNewNode(self.plight)
        self.plnp.setPos(x, y, z+0.1)
        self.plight.setShadowCaster(True)
        main_app.render.setLight(self.plnp)
    def Del_(self,main_app):
        main_app.render.clearLight(self.plnp)      


class water():
    def __init__(self):
        self.setTwoSided = False
        self.Run = False
        self.can_collision = True
        self.Scale = False
        self.pos = False
        self.disremove = False
        self.reflection = True

class torch(ShowBase):
    def __init__(self):
        self.setTwoSided = False
        self.Run = True
        self.can_collision = True
        self.Scale = [0.05,0.05,0.05]
        self.pos = [0,0,-0.4]
        self.disremove = False
        self.reflection = False

    def Run_(self,main_app,x,y,z):
        #self.lightpivot = main_app.render.attachNewNode("lightpivot")
        #self.lightpivot.setPos(x,y,z)
        #self.lightpivot.hprInterval(10, LPoint3(360, 0, 0)).loop()
       # plight = DirectionalLight("directionalLight")
     #   plight.setColor((1, 1, 1, 1))
   #     plnp = self.lightpivot.attachNewNode(plight)
      #  plnp.setPos(x,y,z)
   #     main_app.render.setLight(plnp)
        self.plight = PointLight('plight')
        self.plight.setColor((150, 50, 10, 2))
        self.plight.attenuation = (0, 0, 100)
        self.plnp = render.attachNewNode(self.plight)
        self.plnp.setPos(x, y, z+0.1)
        self.plight.setShadowCaster(True)
        main_app.render.setLight(self.plnp)
    def Del_(self,main_app):
        main_app.render.clearLight(self.plnp)
        #self.plnp.hide()
        print(1111111)
        
class grass(ShowBase):
    def __init__(self):
        self.setTwoSided = True
        self.Run = False
        self.can_collision = True
        self.Scale = False
        self.pos = False
        self.disremove = False
        self.reflection = False
        
class glass(ShowBase):
    def __init__(self):
        self.setTwoSided = False
        self.Run = False
        self.can_collision = False
        self.Scale = False
        self.pos = False
        self.disremove = False
        self.reflection = False
#class grass_Guo(ShowBase):
   # def __init__(self):
       # self.Run = False
       # self.can_collision = True
       # self.Scale = False
       # self.pos = False
class land_gree(ShowBase):
    def __init__(self):
        self.setTwoSided = False
        self.Run = True
        self.can_collision = False
        self.Scale = False
        self.pos = False
        self.disremove = False
        self.reflection = False
    def Run_(self,main_app,x,y,z):
        main_app.add_scene.setH(random.randint(0,4)*90)

        
    def Del_(self,main_app):
        pass

class music(ShowBase):
    def __init__(self):
        self.setTwoSided = False
        self.Run = False
        self.can_collision = False
        self.Scale = False
        self.pos = False
        self.disremove = True
        self.reflection = False


class lamp():
    def __init__(self):
        self.setTwoSided = False
        self.Run = True
        self.can_collision = False
        self.Scale = False
        self.pos = False
        self.disremove = False
        self.reflection = False
        
    def Run_(self,main_app,x,y,z):
        self.plight = PointLight('plight')
        self.plight.setColor((255, 161, 98, 2))
        self.plight.attenuation = (0, 0, 100)
        self.plnp = render.attachNewNode(self.plight)
        self.plnp.setPos(x, y, z+0.1)
        self.plight.setShadowCaster(True)
        main_app.render.setLight(self.plnp)
    def Del_(self,main_app):
        main_app.render.clearLight(self.plnp)      

(main.py和Mode_FUNCTION.py 在同一文件夹内)

鍵位:wasd移動     f1切換視野  f2 f3 調節視野   e 背包  shift飛行模式 (上下調節高度)

4.添加地图

        我想到直接读取txt文件来加载地图。。。

MAINWORD.txt

1.5*0.5*-1.0
-1.5*-0.5*-1.0
-1.5*1.5*-1.0
-1.5*2.5*-1.0
1.5*2.5*-1.0
1.5*3.5*-1.0
0.5*3.5*-1.0
-0.5*3.5*-1.0
-1.5*-1.5*-1.0
1.5*-1.5*-1.0
-0.5*-2.5*-1.0
-1.5*-2.5*-1.0
0.5*-2.5*-1.0
1.5*-2.5*-1.0
2.5*1.5*-1.0
2.5*0.5*-1.0
2.5*-0.5*-1.0
2.5*-1.5*-1.0
2.5*-2.5*-1.0
2.5*2.5*-1.0
2.5*3.5*-1.0
3.5*3.5*-1.0
4.5*3.5*-1.0
3.5*1.5*-1.0
3.5*2.5*-1.0
4.5*2.5*-1.0
4.5*1.5*-1.0
3.5*0.5*-1.0
3.5*-0.5*-1.0
3.5*-1.5*-1.0
3.5*-2.5*-1.0
4.5*-2.5*-1.0
4.5*-1.5*-1.0
4.5*-0.5*-1.0
5.5*-3.5*-1.0
6.5*-3.5*-1.0
7.5*-3.5*-1.0
8.5*-3.5*-1.0
9.5*-3.5*-1.0
9.5*-2.5*-1.0
9.5*-1.5*-1.0
9.5*-0.5*-1.0
9.5*0.5*-1.0
9.5*2.5*-1.0
9.5*3.5*-1.0
-1.5*4.5*-1.0
-0.5*4.5*-1.0
0.5*4.5*-1.0
1.5*4.5*-1.0
2.5*4.5*-1.0
3.5*4.5*-1.0
4.5*4.5*-1.0
5.5*4.5*-1.0
6.5*4.5*-1.0
7.5*4.5*-1.0
8.5*4.5*-1.0
9.5*4.5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
-2.5*3.5*-1.0
-2.5*4.5*-1.0
-3.5*3.5*-1.0
-3.5*4.5*-1.0
5.5*5.5*-1.0
4.5*5.5*-1.0
3.5*5.5*-1.0
2.5*5.5*-1.0
1.5*5.5*-1.0
-3.5*5.5*-1.0
-2.5*5.5*-1.0
-1.5*5.5*-1.0
-0.5*5.5*-1.0
0.5*5.5*-1.0
2.5*-1.5*4.0
1.5*4.5*3.0
1.5*4.5*1.0
1.5*4.5*2.0
1.5*0.5*4.0
1.5*0.5*3.0
1.5*-2.5*1.0
1.5*-2.5*2.0
7.5*-3.5*0.0
7.5*-3.5*1.0
7.5*-3.5*2.0
7.5*-3.5*3.0
7.5*-4.5*3.0
7.5*-3.5*4.0
7.5*-3.5*5.0
7.5*-3.5*6.0
7.5*-4.5*4.0
7.5*-4.5*5.0
8.5*-3.5*3.0
8.5*-3.5*4.0
8.5*-3.5*5.0
7.5*-2.5*3.0
7.5*-2.5*4.0
7.5*-2.5*5.0
6.5*-3.5*3.0
6.5*-3.5*4.0
6.5*-3.5*5.0
6.5*-4.5*4.0
6.5*-4.5*5.0
8.5*-4.5*4.0
8.5*-4.5*5.0
8.5*-2.5*4.0
8.5*-2.5*5.0
6.5*-2.5*4.0
6.5*-2.5*5.0
5.5*3.5*0.0
5.5*2.5*0.0

 WORDMODE.txt

mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//salt.egg
mode//salt.egg
mode//salt.egg
mode//salt.egg
mode//salt.egg
mode//salt.egg
mode//salt.egg
mode//salt.egg
mode//salt.egg
mode//salt.egg
mode//salt.egg
mode//salt.egg
mode//salt.egg
mode//salt.egg
mode//salt.egg
mode//salt.egg
mode//salt.egg
mode//salt.egg
mode//salt.egg
mode//salt.egg
mode//salt.egg
mode//salt.egg
mode//salt.egg
mode//salt.egg
mode//salt.egg
mode//salt.egg
mode//salt.egg
mode//salt.egg
mode//land_gree.egg
mode//water.egg
mode//water.egg
mode//water.egg
mode//water.egg
mode//water.egg
mode//water.egg
mode//water.egg
mode//water.egg
mode//water.egg
mode//water.egg
mode//water.egg
mode//water.egg
mode//water.egg
mode//water.egg
mode//water.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//glass.egg
mode//glass.egg
mode//glass.egg
mode//glass.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//land_gree.egg
mode//Birch_planks.egg
mode//Birch_planks.egg
mode//glass.egg
mode//glass.egg
mode//Birch_planks.egg
mode//redstone_lamp_on.egg
mode//glass.egg
mode//glass.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_wood.egg
mode//Tree_leaves.egg
mode//Tree_leaves.egg
mode//Tree_leaves.egg
mode//Tree_leaves.egg
mode//Tree_leaves.egg
mode//Tree_leaves.egg
mode//Tree_leaves.egg
mode//Tree_leaves.egg
mode//Tree_leaves.egg
mode//Tree_leaves.egg
mode//Tree_leaves.egg
mode//Tree_leaves.egg
mode//Tree_leaves.egg
mode//Tree_leaves.egg
mode//Tree_leaves.egg
mode//Tree_leaves.egg
mode//Tree_leaves.egg
mode//Tree_leaves.egg
mode//Tree_leaves.egg
mode//Tree_leaves.egg
mode//Tree_leaves.egg
mode//Tree_leaves.egg
mode//Tree_leaves.egg
mode//grass_Guo.egg
mode//grass_Guo.egg

5.效果展示

...視頻传不上来,算了

 6资源分享

链接:https://pan.baidu.com/s/1uH0WkP9jvZnbH-mQS2bclw?pwd=wwii 
提取码:wwii

7结语 

陆陆续续看了panda3d官网一年多才写出了个这玩意,用百度翻译的外网真的很难看懂。。。

panda3d官網:Panda3D Manual — Panda3D Manual

标签:land,1.0,python,Minecraft,self,gree,panda3d,mode,egg
From: https://blog.csdn.net/c211562fcyg/article/details/139664944

相关文章

  • 哪些方法可以让 Python 代码易维护
    随着软件项目进入“维护模式”,对可读性和编码标准的要求很容易落空(甚至从一开始就没有建立过那些标准)。然而,在代码库中保持一致的代码风格和测试标准能够显著减轻维护的压力,也能确保新的开发者能够快速了解项目的情况,同时能更好地全程保持应用程序的质量。使用外部库来检查代......
  • 基于python-CNN深度学习的手势识别数字-含数据集+pyqt界面
    代码下载:https://download.csdn.net/download/qq_34904125/89379220本代码是基于pythonpytorch环境安装的。下载本代码后,有个requirement.txt文本,里面介绍了如何安装环境,环境需要自行配置。或可直接参考下面博文进行环境安装。深度学习环境安装教程-anaconda-python-pyto......
  • 基于python_cnn深度学习的decks的裂缝识别-含数据集+pyqt界面
    代码下载:https://download.csdn.net/download/qq_34904125/89379212本代码是基于pythonpytorch环境安装的。下载本代码后,有个requirement.txt文本,里面介绍了如何安装环境,环境需要自行配置。或可直接参考下面博文进行环境安装。深度学习环境安装教程-anaconda-python-pyto......
  • 【Python】成功解决UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0x80 in p
    【Python】成功解决UnicodeDecodeError:‘gbk’codeccan’tdecodebyte0x80inposition45:illegalmultibytesequence 下滑即可查看博客内容......
  • Python: faces Swap
     #encoding:utf-8#版权所有2024©涂聚文有限公司#许可信息查看:两个头像图片之间换脸#描述:https://stackoverflow.com/questions/902761/saving-a-numpy-array-as-an-image?answertab=votes#Author:geovindu,GeovinDu涂聚文.#IDE:PyCharm2023.1......
  • Python简单实现:读取文件夹并数字排序
    python中os.listdir()方法用于返回指定的文件夹包含的文件或文件夹的名字的列表importospath="../data/materials/test/"path_list=os.listdir(path)print(path_list)输出['1.jpg','10.jpg','11.jpg','12.jpg','13.jpg',......
  • Python中 sys.argv[]的用法解释
    sys.argv就是一个从程序外部获取参数的桥梁,这个“外部”很关键,因为我们从外部取得的参数可以是多个,所以获得的是一个列表(list),也就是说sys.argv其实可以看作是一个列表,所以才能用[]提取其中的元素。其第一个元素是程序本身,随后才依次是外部给予的参数。下面我们通过一个极简单......
  • Python中常用的几个内置方法(max()/min()、filter()、map()、sorted、reduce())
    1.max()/min()传入一个参数(可迭代对象),返回这个可迭代对象中最大的元素可以设置default关键字参数,当这个可迭代对象为空时,返回default的值传入多个参数,返回这些参数中最大的参数多个参数必须是同类型的两种方法都可以设置key关键字参数(传入函数)"""max(it......
  • Python实现:查找文本文件中重复的汉字
    查找文本文件中重复的汉字,找到在所在行号文本文件格式大小多少前后左……text.pyimportosimportrelist=[]same=0total=0index=[]withopen("1.txt","r",encoding="utf-8")asf:forlineinf.readlines():line=line.strip('\n......
  • python爬虫
    What's爬虫?简单来说:爬虫,即网络蜘蛛,是伪装成客户端与服务器进行数据交互的程序。代码frombs4importBeautifulSoup#网页解析importurllib.request,urllib.error#制定URL,获取网页数据importre#正则表达式进行文字匹配importx......