u
ubuchy

Main Scene Broke My Sword Mob

Hi, when I created the "Main" generated scene I found out my Sword mobs stopped working correctly. I used a Tween to interpolate between the sword position and the (player position + some distance) On attack start the Swords just teleport instantly out of screen to some distant position.

I found a fix for this, but I don't think it's ideal. What I did is I changed the spawning behavior. By default the mobs get attached to its parent, which would be the corresponding room's "mobs" node. But this I found is the cause of the problem. The interpolation works only, when the Robot and the Sword have the same parent scene. So I attach the mobs to the root scene.

I suppose this would not be Ideal as it could be probably handy to have the mobs organized. And I really don't understand why the sword does not work, when it's under a different parent scene. Is it because the global_position is relative to its scene (so a scene under a scene has different global position)? If so, how would I get the global_position for the root scene in the Main scene? Or does the issue lay somewhere else? I'm probably misunderstanding something here.

  • u
    ubuchy replied

    Oh never mind! I realized I was interpolating "position" instead of "global_position"! Now this makes sense as the "position" is relative to the parent scene, if I understand correctly. So that's why it worked in a single scene.