Hello,I share with you these 5 lines of code to ask some questions.
1.cont = bge.logic.getCurrentController()
2.obj = cont.owner
3.act = cont.actuators["move"]
4.sens = cont.sensors["land"]
5.sens_2 = cont.sensors["bonus"]
Questions
1)In line 1,I understand that the variable cont is assigned a value of “bge.logic.getCurrentController()” which I guess is the python controller,so that I can use everything that connects with him in my script.Correct?
2)This code line,assigns the object(for example the cube that I am working on) to a variable.Is this correct?If yes,can you give me some examples as to where I can use this variable.Cause so far in my practise I have achieved all I want to do without having to use the “obj” variable.
3)In line 5,I assign to sens_2(variable) the result of the sensor which I have named bonus.This sensor belongs to another object,different from the cube that I am working on.However I want to use it in the script of my cube(which runs through the python controller that exists in the cube controllers).How can I do this?I guess I need to change something in line 1 at least.
I am gonna share with you the blend file in case you need it to understand or to comment on my beginner code for something important.
http://www.pasteall.org/blend/27117