speed = 0;
Here we go(explanation included)!If you only call it once, it will only happen once. I'm guessing you don't want it to stop, rather you are only wanting it to stop adding more speed to it. If you post code, maybe we can figure out what you should change to make that happen. You may also want to better explain exactly what is happening, and explain exactly in good detail what it is that you are wanting to happen instead.
Thanks! Combining it with the code that on collision it stops it works like butter. It works since it just bounces off on collision. Thanks!Future reference, it is better to place both the code and the explanation here instead of in a pastebin. We have code tags so it can even maintain the spacing for you.
Looking at the code, it doesn't seem like the call to motion_add() should be happening multiple times without multiple mouse clicks. You are using the "pressed" version of the function to check the mouse click so it isn't repeating...and you ARE setting the "hasFired" variable back to false after doing the motion_add(). The trick is that you have multiple hasFired variables...one in oShotgun, and one in the player. Notice how you are using the oShotgun.hasFired first to check if you shot. But, when you set it false, you did not put the "oShotgun." part, so you created a variable on the object that is running the code, which is the player. Meanwhile, the if statement continues checking the variable on the shotgun object that never got set back to false.