Post by David Sorrentino on May 8, 2011 5:30:02 GMT -5
The method "update_camera" is called every frame by the thread "camerathread". The variable "elapsed" represents the time elapsed from the last execution of the above-mentioned thread and the current execution. In this way you can take in account the effective time elapsed during the pression of a given key. If you put the line print(taskMgr.getAllTasks) before the method "run()", you can see the list of the tasks managed from panda. I hope to have been helpful!
I would never die for my beliefs, because I might be wrong...
Post by David Sorrentino on May 8, 2011 5:36:15 GMT -5
To make the class Room visible within the class World, you should import it. So, try to put at the beginning of the file world the following line: from Room import Room that means: from the file Room import the class Room. Remember also to insert the other imports required by the class Room.
Post by Hannes Vilhjalmsson on May 8, 2011 12:21:04 GMT -5
If you place your Room class in a separate file, then you have to import that file into your main program as a module before you can instantiate the class. Importing modules is something that is a little bit different in Python than in Java, so you should carefully read about it before doing it. Here is a good tutorial about Python imports:
That said, you don't actually have to keep Room in a separate Python file. You can also keep the class definition inside the same file as your World. Python is very flexible that way. But of course is it not good programming style to end up with a huge file full of classes (but it often happens in Python ;-) ).
Finally let me add that elapsed time refers to the time that has passed since the function was last called. So, the size of the movement has to be in relation to how much time it took (e.g. if you were calling an update function for drawing a car, and you know the car is driving at 90 Km/h, then if you know that the function was last called 2 hours ago, you will need to put the car 180 Km away from its last location).
Cheers, - hannes högni
P.S. Thank you David for posting your responses. I encourage you all to use this forum for helping each other out.