hey folks,
has been a long long time since I was involved with blender. Ive have lately been getting back into it since my boss is pretty interested in creating a game using blender. I started getting into python because I knew I had to in order to have a decent running game. I was using ActionScript for quite a while, so I got an ok understanding for programming. transferring to Python syntax has not been too much of a hassle, but understanding the modules and the way blender operates has really had me in a bind. and I have been using all the sources posted throught, so Its a matter of getting through the learning barrier
so I got a set up with a scene where Im adding a object (in realtime) that will run a course of targets directect by the "trackTo" controller. by the time it reaches the last target the object will be terminated.
problem I am having is the object is terminating at the first target. I believe it is because the near sensor is continuously sending a pulse that runs out the script prematurely. is there a good solution anybody here can help me with, or is there a better approach? if I need to post more info let me know, heres the script so far:
import GameLogic as GL
cont = GL.getCurrentController()
own = cont.getOwner()
moveX = cont.getSensor('moveX')
move = cont.getActuator('move')
moveToX = cont.getActuator('moveToX')
qTo = cont.getSensor('qTo')
goTo = cont.getActuator('acTo')
XXX = cont.getActuator('XXX')
trackTo = ['orderQ','waitQ','irateQ','outQ']
ticker = own.ticker
init = own.ticker
Rxx = own.init
### set the initial values
def init():
if Rxx == 0:
moveX.setValue('True')
qTo.setProperty('orderQ')
moveToX.setValue('True')
goTo.setObject(trackTo[Rxx])
GL.addActiveActuator(goTo, 1)
GL.addActiveActuator(move, 1)
GL.addActiveActuator(moveToX, 1)
if Rxx == 1:
moveX.setValue('True')
qTo.setProperty('waitQ')
moveToX.setValue('True')
goTo.setObject(trackTo[Rxx])
GL.addActiveActuator(goTo, 1)
GL.addActiveActuator(move, 1)
GL.addActiveActuator(moveToX, 1)
if Rxx == 2:
moveX.setValue('True')
qTo.setProperty('irateQ')
moveToX.setValue('True')
goTo.setObject(trackTo[Rxx])
GL.addActiveActuator(goTo, 1)
GL.addActiveActuator(move, 1)
GL.addActiveActuator(moveToX, 1)
if Rxx == 3:
moveX.setValue('True')
qTo.setProperty('outQ')
moveToX.setValue('True')
goTo.setObject(trackTo[Rxx])
GL.addActiveActuator(goTo, 1)
GL.addActiveActuator(move, 1)
GL.addActiveActuator(moveToX, 1)
own.init = Rxx + 1
if own.init>5:
GL.addActiveActuator(XXX, 1)
if qTo.isPositive():
moveX.setValue('False')
moveToX.setValue('False')
GL.addActiveActuator(goTo, 0)
GL.addActiveActuator(move, 0)
GL.addActiveActuator(moveToX, 0)
qTo.setProperty(nearTo[Rxx])
init()