qurobullet
qurobullet copied to clipboard
Add Way to Create Special Properties/Custom Behavior for Bullets
Hello! I was thinking of ways to replicate special properties from BulletML (the most well-known bullet pattern generator) in Qurobullet. Things like vanishing bullets, bullets pausing movement or changing direction every few frames, homing bullets, etc.
I think the best way would be to:
- Add custom data to the bullets (maybe it inherits from its BulletSpawner) to mark that it has a special property (Edit: just realized that the BulletType's custom data is accessible in the Bullet object through get_type(), so maybe this # isn't needed anymore)
- Emit a signal from BulletServer's spawn_bullet() (and hence spawn_volley() as well) whenever a bullet is spawned that includes that bullet, then the developer can connect it to another script to make custom behavior. The functions will also return the bullet spawned instead of just void. This way the developer doesn't have to check the entire array of active bullets (through get_live_bullets()) per frame, and can just add the bullets with custom behaviors in another array.
What do you think? If you think this is a good idea, I think I can make edits to those functions 😁
PS. I'm writing an article on how to create bullet-hell patterns in Godot using the Qurobullet module. Would that be okay with you? I'll show you the article before publishing on my website 😄
Sorry for the late reply, but this seems like a great idea!
For implementing custom behaviour though, why emit a signal in spawn_bullet? I think I'd rather see a separate function that emits signals with behaviour updates for bullets so the bullet spawner doesn't have to emit a new bullet or volley to alter behaviour of the existing ones. That is, if I'm understanding your plan correctly.
If you feel like you can implement this, by all means go for it! I'd offer to try and add it myself, but I'm just getting settled into my first professional dev position, so I'm a little too busy to make big changes to the project myself. So I'd appreciate it!
When you submit your PR, I may suggest changes or alter things myself to make sure it fits in with the flow of the rest of the module well. Is that okay?
Okay, got it! Regarding the function, the reason I suggested a signal on spawn_bullet was so a programmer could set custom behavior functions as well as updates through specific scripts in GDScript.
I can also imagine what you're describing though! The changing of behavior could be attached to time or the number of frames. When that's done, a signal could be given out to change behavior and it can be connected to whatever the programmer wants.
Regarding the implementation though, I'll have to read up more on my C++ before I try tackling that 😅 feel free to suggest changes once I submit a PR! It's your repo after all 😁
Edit: Maybe both could be implemented? a signal when a bullet is spawned, then signals for behavior changes? The former seems easier to implement, while the latter would take some time. Might as well have the feature first while it's being worked on 😁
Btw, I think that the custom behavior from BulletML can already be replicated through custom data. I'll tinker with it a bit more and get back to you 😁 Are custom data unique to each bullet, or is it all attached to BulletType? I was thinking that I could just modify the custom data per bullet, though that might actually change the BulletType for all of them 😅
Custom data is only stored in the type, so yeah if you need each bullet to track its own custom data you're probably going to have to add it to the bullet object and figure out a way to set it from the bullet spawner.