How to make an option that can change range/speed of bullet ingame?

I want to make an option that can change the range/speed of bullets while playing games. For example, I make an object that when you collise it, it will give you power to increase range/speed of the bullet you fire.

  1. Is the “Emit” can change the range/speed of bullets while playing games? If not, how to change it?
  2. I’m adding some new weapons to beat the game easier and the range/speed of those weapons are also different to the main gun (the first one) I’m added to the game. I worry that it will cause some bugs so how to fix it?

Emit force

Yeah, that one, can I change its value?

No, I don’t think so. But maybe you can have multiple emit behaviors connected to a router with different emit forces emitting the same object.

Hm, good idea. So I can use it with other guns? I think it’s gonna mess up a little bit but ok.

Yeah obviously
It probably won’t mess up unless you don’t have common sense

You could attach a non-solid object to the player that rotates based on player movement, cursor location, or whatever input that rotates that guns direction.

Then you could use the spawn behavior instead of the emit.

Although when a bullet is spawned, you want it to extract the rotation of the second object that is mounted on the player, so it’ll aim in the direction when it first spawns.

Then you can use a number and velocity to change its forward momentum. Which allows you to make any custom speed you want.

The emit behavior has an emit force which is how much force is applied to an object when it’s emitted. The only downside to this is if you’re making a top down game where there is little to no friction so using any number of force doesn’t change the speed much.

1 Like

Like Maniac said, spawning the bullets would be better than multiple emit behaviors (unless it’s only 2 different types of bullets, then it doesn’t really matter if you use 2 different Emits). Just be aware that if you use Spawn, you’ll have to adjust the position the bullet is fired from so it looks natural like emit would.

For the bullet, you’ll want to spawn it in, then you can send it a message (“Send to last spawned”). This message will be the rotation. You can do the same for velocity, or just use Starting Value depending on how the system was built. Using Globals is another option, though I prefer messages.

But unless you have varying bullet speeds, like you can collect an unknown amount of an object to speed it up, the. You’ll want to use spawn. But if it’s just 1-4 bullet speeds, it’s perfectly fine to use a Router and Emit as well.

1 Like

I know, but I’m gonna add some more weapons and they will use many types of bullets, which means the speed, range and DMG will definitely be different. But well, thanks for telling me about that.

Yeah with a dynamic system like that, spawn is better to use. Though it depends how comfortable you are with the behavior, as it could make things more difficult if you don’t know how it works. However, it’s always good to try something new

Alright, I will try it someday