The last thing we'll cover in this chapter is how to load a Panda3D game from the command prompt. Until the game is packaged and ready for shipping, this is how we'll run it. Don't worry, it's easy.
Open a command prompt by going to the Start menu | All Programs| Accessories and choosing Command Prompt.
Open Windows Explorer the same way.
In Windows Explorer click on the View menu at the top, highlight toolbars, and if Address Bar does not have a check before it, click on it. This will show your current directory in the window.
Navigate Windows Explorer to
BGP3D/Demo
and copy the entire address bar with Ctrl+C or by right-clicking and selecting Copy.Return to the Command Prompt window and type in
cd
followed by a space. Then right-click on the Command Prompt window and select Paste. This will insert the directory address you copied from Windows Explorer.Hit Enter and you'll see the directory in the Command Prompt change. Next, type in
python main.py
and hit Enter. The game will launch.
Not bad, right? We just learned how to run a Python file from the command prompt, something we'll be doing quite a bit. The python
command we used tells the system to use the Python interpreter to run the file we supply.
main.py
is the name of the file that starts Panda3D and the game components. We'll go into more depth about how that works in the next chapter, so get ready!