First Panda Project

Hey guys, been working on my first panda project, sort of a culmination of my explorations of the different tutorials and samples I have found.

I am thinking about starting on something new, I have a game concept in mind, so I thought I would publish this here and invite you guys to help me learn from my mistakes ^.^

Seriously though, I would like to improve this; The collision is horrible and I would like to be able to fix Mercury & Mars’ orbits. Additionally, I don’t know how to break it into separate classes, so any advice on that would be welcome as well.

Thanks in advance.

Looking at your code, there are a lot of repeated parts like:

        self.mercury = loader.loadModel("models/planet_sphere")
        self.mercury.setScale(0.385 * self.sizescale)
        self.mercury.setPos(0.38 * self.orbitscale, 0, 2)
        self.mer_tex = loader.loadTexture("models/mercury_1k_tex.jpg")
        self.mercury.setTexture(self.mer_tex, 1)
        self.merCollider = self.mercury.attachNewNode(CollisionNode('mercnode'))
        self.merCollider.node().addSolid(CollisionSphere(0, 0, 0, 1))
        self.venus = loader.loadModel("models/planet_sphere")
        self.venus.setScale(0.923 * self.sizescale)
        self.venus.setPos(0.72 * self.orbitscale, 0, 0)
        self.ven_tex = loader.loadTexture("models/venus_1k_texa.jpg")
        self.venus.setTexture(self.ven_tex, 1)
        self.venCollider = self.venus.attachNewNode(CollisionNode('vencnode'))
        self.venCollider.node().addSolid(CollisionSphere(0, 0, 0, 1))

When you’ve some repeated code, that’s a clue about something you can improve from an software engineering point of view. I didn’t study your code deeply, but these parts of code which define the planets suggest me that you may improve your code defining a class Planet and inserting the “right” code inside it.