Use the while mouse is pressed on something event -
10-13-2020, 07:50 AM
You have done a good job trying to solve this problem, but as was pointed out, Alice 2 puts events into a Queue and will still fire them in sequence no matter how long you Wait. (Alice 3 addresses this problem with an option to ignore multiple clicks on mouse events, but that does not help you here.)
However, it is possible to convert the "When mouse is clicked on..." event to a "while the mouse is pressed..." event, which will solve the problem.
1) Right-click on the "When mouse is clicked on... " tile
2) Select "change to..."
3) Select "While the mouse is pressed on..."
4) Select your mouse-press target
5) You now have three options Begin, During, and End. Add your method call to either Begin or End, not During. Your gun should now only fire once either when you click the mouse, or when you release the mouse (depending on which option you chose.
Begin responds to the mouse-press one time when you start to press the mouse button
End responds to the mouse-press one time when you release the mouse button
During continually responds to the mouse-press as long as you are holding the mouse button.
I have attached a demo world "bunnyhop.a2w" that illustrates this event.
Please let me know if you have any questions.
Don Slater
Alice Project
Don Slater
Alice Team
Carnegie Mellon University
|