I have a demo I made years ago and I’m trying to clean up the code a bit for my portfolio. It was originally made with an older version of python and panda3d. I believe I used to use command prompt to goto the path of the project and just type: ppython puckman.py
I currently have python 2.5.1 and the latest panda3d release (1.4.2)
How do I compile and run this code? I don’t want to make an executable. I just want to be able to mod my old code and run it for now.
When I make a game using pygame, all I have to do is double click the icon and the game runs. I try the same with my panda3d game and a command prompt window pops up for a second and nothing happens.
It’s been about 2 years since I’ve used panda3d, so any help would be greatly appreciated.
Ok, I figured out the problem with running it with ppython that came with panda3d (the 1.4.2 version). When it compiles I get:
DirectStart: Starting the game.
Warning: DirectNotifity: category ‘Interval’ already exists
Known pipe types:
(3 aux display modules not yet loaded.)
:util(warning): Adjusting global clock’s real time by 1.5584 seconds.
Trackeback (most recent call last):
and it goes through till it gets to soundFX.py, line 9.
TypeError: Error when calling the metaclass bases
module.init() takes at most 2 arguements (3 given)
I checked soundFX.py and it only has 1 arguement to init (self).
I’m not sure if it’s not working because the previous version of panda3d I was using was 1.1 or 1.2 (whatever was current in january of 06)
Anyone know what the problem is? I have an executable installer and installed the same version as the source code I have and it worked.
This is a problem with the way you have imported DirectObject. A common problem with old Panda code. You are using DirectObject as a class, so you need to be sure you import it as a class:
from DirectObject import DirectObject
Hm? Are you sure it’s not:
from direct.showbase.DirectObject import DirectObject
I already had it setup like that except I do it like
from direct.showbase.ShowBaseGlobal import *
from direct.interval.IntervalGlobal import *
from direct.showbase import DirectObject
self.cameraX = ClassGlobals.p1.puckWalk.getX() - 150
self.cameraY = ClassGlobals.p1.puckWalk.getY()
self.cameraZ = ClassGlobals.p1.puckWalk.getZ() + 90
self.origCameraX = self.cameraX
self.origCameraY = self.cameraY
self.origCameraZ = self.cameraZ
self.camera = camera
I tried your way and just subbing DirectObject for DirectObject.DirectObject as the classcamera parameter. Still didn’t work.
Nevermind… was referencing DirectObject in certian places and DO.DO in other places… solved that problem. but I’m still going through and importing classes that I didn’t need to in the prior versions. For example, I was able to use NodePath before and now I have to import in in pandac.
I’m having a problem makinging a CollisionSphere now. Is their something I have to import that I’m not seeing?
What is the error you get?
There are two (if not more) possibilities: either an import failure (or you forgot one), but I also remember the getSolid function returns a const object now, and you have to use the modifySolid method to modify collisionsolids now.