Ok so I have made my character be able to do many things now, punch kick, and now throw spears. The problem is that I wan’t to make it so I have to hold right click than let go for it to throw a spear, and If I just spam right click spears just keep coming. I only wan’t to be able to have to hold right click than let go for a spear to throw, and only be able to do that once per 2 seconds.
I also have a problem where the spear doesn’t collide with the floor, and I changed the collision to collide with everything. It collides with the physic objects though?
I do something similar in the game I’m working on, where the firing of the projectile is on button release. I’m not at home and can’t post a screenshot of my blueprint, but this is what I do:
Have the following:
- “SpearCharging” Bool (for whether or not you are readying your spear to throw)
- “SpearChargeTime” Float (to store how long we’ve been readying the spear)
- “SpearDelay” Float (how long we want the player to wait before the spear can be thrown)
On event of LeftClick Pressed, set SpearCharging to TRUE and set SpearChargeTime to 0. Off the EventTick, have a branch taking in SpearCharging and if TRUE add the Delta to SpearChargeTime.
On the event of LeftClick Release, simply compare if SpearChargeTime >= SpearDelay. If so, launch spear, if not, don’t.