-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bullets spawn elsewhere when root node is moved #39
Comments
Hey, thanks for the bug report! I see what you mean, and I think the issue is that the BulletServer node isn't designed to be attached to anything that can move. So in your case you could probably resolve this by removing the BulletServer from the I'll keep this issue open though, because small scenes instancing their own bullet server to use is a use-case that should be supported, and I'd like to make changes to allow for that when I have time. It should be just a matter of adding a toggle on BulletServer that ensures it's always positioned at a global (0,0) regardless of where its parent is. |
Thanks much appreciated 😄 BulletServer on the base level does make sense after that moving the node with the BulletSpawner to that level does work and I'm able to instantiate the scene as a child |
Hi, the issue you're facing here is the same as the original post's, and has the same solution I already described above: Do not make the If you move your existing server node out of the I don't mind necro-ing an old thread if necessary, but next time please try the suggested solution from the thread first. |
Oh and good luck with your project by the way! It's looking pretty cool. |
From my post:
Basically the issue persists regardless of that. I did read the suggestion, and yet I still see issues. |
Sorry for missing that note in the middle of your post, but all I can work from is your description of the problem and what you've shared with me, and all you've shared is a node configuration that's been stated to be unsupported by the module. I don't have enough insight into your project to know anything else that might be going wrong with it, and just saying that it's "even more broken" when configured correctly doesn't give me enough context to debug. |
Apologies if I came off terse - I Just wanted to call out that I had in fact done it both ways and was encountering issues regardless. When not in the parallax the bullets still exhibit the behavior, I initially described. Additionally, they fire in the reverse direction. See the below GIF: What info can I provide here to help troubleshoot further? |
That gif is extremely helpful context, thank you!! It appears to me that there might be an issue with the bounding box that bullets are confined to, since they appear to spawn and then pop immediately on the next frame... As an experiment, does it behave the same way if you change the server's "Play Area Mode" to "Infinite"? If that fixes it, you might be able to get away with using an infinite play area and using the bullets' max lifetime to despawn them instead of automatically despawning them when they go offscreen, or maybe some manual play area setup could work for you. |
Interesting. The infinite trick didn't seem to do it, but the bounding boxes did appear to be part of the issue: I had to offset the spawner outside the collision box of the enemy ship, and then the bullet pattern worked as expected. The bullets, I assume, were popping while moving in the collider? The next issue was making the enemy move. It seems that having the enemies as part of the parallax (a lazy way to get them to appear like they're flying by you during the level, I suppose) is the other big issue. Even if the server is detached, when the ships are parented to a parallax group, the behavior is now the flicking exhibited in the test scene. The fix seems to be removing them from the parallax all together and having them move separately, which means I have to rework how enemies appear on the scene. However, while it may be a little more work on that front it does seem to function now, so I can work with this if it's how the system works. I guess the only remaining question is: should it still work if the enemies are children of the parallax? Is this behavior still weird or is this actually in line with how the underlying code powering the system works? |
I think in theory it SHOULD still work if the enemies are part of a parallax group like that. Not sure offhand why it wouldn't, but to be honest I haven't built anything with that kind of setup so it's possible there's something I overlooked when writing the module. I'm curious if your enemies are using the same collision layer as the bullets they're firing... because in that case when the bullets spawn within the ship's collision shape, they'll "collide" with it and pop like we're seeing above. If they are using the same layer, try changing the bullets to a different collision layer and see if the parallax problem still occurs. If they're on different layers, feel free to ignore this tangent lol. |
That also appeared to be part of the issue, yes (in both the test scene and the actual scene with the parallax scrolling). I moved the spawner down to compensate for that as I had other logic requiring the collision of bullets be on the same layer as ships that if not for the fact this is jam game, I'd probably just re-do. |
Great, glad we managed to get to the bottom of it, and that you seem to have things working now! Best of luck with the jam, and I'd love to see the game when you're done with it. |
Whenever I attach the BulletServer & BulletSpawner to a CharacterBody2D (or a node attached to a CharacterBody2D), then place the CharacterBody2D node on a different scene I noticed that the bullets do not spawn at the point given within the radius
Screenshot of the CharacterBody2D node the spawner is attached to the right of the object a few pixels away
Now attached to a different node with the CharacterBody2D as a child, moved the node into the middle of the screen. Radius is still shown right next to the CharacterBody2D node but the bullets appear in a different position
The text was updated successfully, but these errors were encountered: