Controlling a projectile's distance

I was wondering if anyone could help me out with a rather unusual two-part idea that I would like to implement into the game I’m making.

The first part is that I want to make a projectile that when launched will travel a short distance and then stop in mid-air.

The second, is that I want how far the projectile travels to be determined by how long the player is holding down the shoot button i.e. the longer the player holds the button, the farther the projectile travels before it stops. Basically, its a similar principal to how jumping works in a lot of platformer games like Mario or Sonic.

Any help whatsoever would be greatly appreciated!

Hey there @HungryMoogle! Depending on how you’d like to implement it I could put together a decent example. With jumping it’s an active action, so the action starts when a player hits the button and is told to stop when the player releases it.

A couple questions, are you trying to assign the actual distance when it fires? Like for example, charging it up then assigning the distance when it fires? Or is your gun constantly revving up getting more range firing automatically while you have the trigger held? At the end of the day the system will be relatively the same.

I guess I didn’t explain what I’m trying to accomplish very well. :woozy_face:

What I meant was that when the player simply taps the shoot button, the player shoots out a projectile that will only travel a short distance before coming to a complete stop.

However, if the player instead holds the button down, the projectile will keep moving until the player releases the button or the projectile reaches its maximum distance.

So for the shooter, is what you’d do.

For the bubble

I hate using event tick for anything but if it’s only one bubble at a time, doesn’t matter much. Let me know if you have any questions!

Does it slow down to a stop or stops abruptly once X uus away from the player? If it’s slowing down, is it slowing down from the moment it was fired? Or, lets say, starts slowing down half way down its intended range?

I hate using event tick

Instead of Tick, you could use a sphere overlap:

Set it up so it’s using a new object type that interacts only with the projectile; the projectile leaving the overlap or the player releasing the button arrests the movement.

would need to be re-jiggled a bit and improved if you’re planning on having more active bubbles at a time. It’s always in the details with those things.