Hello all,
I am new to Blender and VERY new to Python, so forgive me if this question seems too basic.
I am trying to run a script that is included in the Blender Gamekit tutorials, and includes the following code:
import GameLogic
4
5 def ranint(min,max):
6 return(int(GameLogic.getRandomFloat()*(max+1-min)+min))
7
8 contr = GameLogic.getCurrentController()
9 owner = contr.getOwner()
10 key = contr.getSensor(“mixitbaby”)
11 near = contr.getSensor(“near”)
12 mess = contr.getActuator(“shuffled”)
13
14 # collects all gongs
15 objs=near.getHitObjectList()
16
17 owner.shuffle = owner.shuffle - 1
18 if owner.shuffle<0:
19 GameLogic.addActiveActuator(mess,1)
20 else:
21 g1 = ranint(0,19)
22 g2 = ranint(0,19)
23
24 pos1 = objs[g1].getPosition()
25 pos2 = objs[g2].getPosition()
26 objs[g1].setPosition(pos2)
27 objs[g2].setPosition(pos1)
The script is failing with the following error:
“ImportError: No module named GameLogic”
I suspected that this had something to do with how my environment variables were set, so I set my PYTHONPATH variable to the following, but it did not help:
C:\PYTHON24;C:\PYTHON24\DLLS;C:\PYTHON24\LIB;C:\PYTHON24\LIB\LIB-TK
So, I am at a loss. Can someone explain this to me?
Thanks!
P.