Hi people, this is a community, and i think the projects should be shared.
This is the my first game on Panda3D is nothing else, but only started the program in March in Panda3D, and did nothing because I had deadlines, but as I became interested in Panda3D, want to see if I improve this game, or create from scratch another better, because it still has many beginner’s mistakes.
The double window problem is present because you import both direct.directbase.DirectStart and ShowBase right here:
from direct.showbase.ShowBase import ShowBase
from pandac.PandaModules import*
from direct.task import Task
import direct.directbase.DirectStart
Usually when structuring a big game with Panda you can choose 2 approaches:
the first is using directStart which gives you global scoping so you don’t need to create a class in order to call Panda’s functions such as loader.loadModel()
the second is subclassing ShowBase as you did, then create an instance of the class and calling run as an attribute of the object.
You mixed them using sounds as globals and the other inside the class as attributes.
I also modified your code in order to work and not showing the grey window (I cut away directStart) and moved the sounds inside the class. I used builtin module in order to let you use those variables with global scoping (too lazy to change all to self.blabla).
Very thanks for the explanation, I’m still new to object oriented programming … And this was my first experience, I hope to contribute to future developments in this forum with the best …