Hey guys, while recently looking at a line of code, I realized that there are a lot of key words in python code that I cant fully understand. While I have a relative understanding of what most of them do, I understand that once my code gets more complex, having an understanding of every keyword will be important. Here is the code I’m looking at:
def setUpCamera(self):
""" puts camera at the players node """
pl = base.cam.node().getLens()
pl.setFov(100)
base.cam.node().setLens(pl)
base.camera.reparentTo(self.node)
This is a small FPS project that treeform made, and I downloaded it and looked into it. Looking at the code, the first thing I come across is the “def” command. While it would appear to me that this is simply a task to be run (once), I’m not sure of the exact meaning of the command. The next thing I want to know is if variables do not need to be created, like in C++ (int variable). I say this because I noticed that “pl” seems to be an undefined variable that just appeared. Those are just a few of my questions, hopefully you guys’ll help me out.
Thank you (a lot),
Me