Hey all,
First of all great that blender artists is back up! With a friends group we are currently working on blender to set up a game like micro machines. The concept is relatively easy and I think its a nice start to try the potential of blender. The modelling doesn’t seem to be a big problem, but the blender BGE is more complex. Especially in 2.5, although it should also be possible here since we are using basic logic.
The situation at the moment is that I have:
- A car object controlled by a movement script (in fact I have 4 cars like that).
- A camera controlled by a cameraControl script, placing the camera based on the location of the cars and reporting when the cars are out of sight.
This is working, but I have to set some variables (e.g. car object name) in the script, which I would rather prefer to set from 1 central control point (the GameModule). Currently I’m playing around with a cube (the GameModule), which has a controller (the GameModuleScript). In this script I want to define all the variables needed for the various scripts.
So the situation is:
- I have a script running on the camera
- I want to have a script running on the GameModule
From the CameraScript I want to call methods from the GameModuleScript. Being in the CameraScript I can get the GameModule object, it’s controller and finnaly the script, but I can’t call any methods from that script. E.g. GetActiveCars() --> returning the 4 car objects of the level.
From examples I note that most people throw all logic inside one script, but I want only the logic relevant for the object to be inside a script, more object oriented. What is the best way to deal with this problem? Is it actually possible to have something like a MainScript, calling functions from other scripts?
Any advice is welcome and would be greatly appreciated,
Regards, Wouter