Greetings. I am just having a minor issue where I made a torch -prop that has a script to spawn flame from layer2. When I Link it in to the game level the flame itself stays in the middle of the main level world (coordinates zero). Exactly where it is in the prop file on layer 2.
Even though the script mentions it should spawn on the empty that is in the tip or the torch.
Should I be more specific in the script on where to spawn the actual flame object?
import bge
import random
cont = bge.logic.getCurrentController()
scene = bge.logic.getCurrentScene()
own = cont.owner
light = scene.objects["light"]
def particles():
particle = scene.addObject("flame", "Empty", 0)
particle.applyMovement((random.uniform(-0.02, 0.02), random.uniform(-0.02, 0.02), 0), True)
light.energy = random.uniform(0.5, 1.0)
if own["on"] == True:
particles()
EDIT: I just realised it could also be an issue wich the grouping? I have all the torch, light, flame, empty in the same group and it’s Linked to the game level. Does this make also the layer 2 spawning object to be constantly visible?
Attachments
prop_torch.blend (1.16 MB)