Moving added object in python

I would only like to use python to control the movement of an added object to the stage. I have this script:

import bge


def main():

    cont = bge.logic.getCurrentController()
    own = cont.owner
    scene = bge.logic.getCurrentScene()

    new = scene.addObject("particle", "Empty.001", 0)
    new.applyMovement([0,0,1], True)


main()

But object only moves by one unit and there is no motion continuation. I want to make a simple particle emitter

you need to add the movement every tic, so with always true, or on the particle add bricks to move it.

Every tic is set. I would like to specify the behavior of the particle in one script to make it universal

Even if the particle-objects where constantly moving, they’d all be moving in the same direction unless you also defined different (random) rotations for each object.

cont.owner.applyRotation()
  • add object on the empty
  • python on the particle
    – now you can script it the way you want

or you need to put the added objects into a list, and loop over that to add speed, etc.

1 Like

No logic brick. I want to create an upbge component. Only python

2 functions,
-1 to spawn object, empty connected to the function
-1 to add speed. etc. to partical. partical connected to this function