Yeah, so i making a game with a bunch of different guns in it. but i am stuck on the rocket launcher. it is supposed to have a time delay between each shot. How do i create the time delay so that a person has to wait x amount of seconds before able to fire again? at the moment i have it so it fires, but if the LMB is clicked really fast repeatedly it will fire at that rate. i want it so no matter how many times LMB is clicked, it wont fire until x seconds later. how can i do this?
Go to the object that handles the mouse click event. Add a new property. Make it a Timer type property. Name it “timer”. Add another property, this time a Float. Name it “delay”. Set it to how many seconds you want to wait in between firing. Now set the logic up like this:
Mouse: Left Click
Expression: timer > delay
Whatever bricks fire your gun
Property: Assign (Prop: timer, Value: 0)
The expression tests to see if the player has waited long enough between firing, and the Property brick resets the timer so that player will have to wait again before firing.
thanks man, really helpful. It’s a problem that’s been bugging me. appreciate it.