Mouse?
by Danny Mejia · in Torque Game Builder · 08/19/2006 (3:40 pm) · 2 replies
How can I stop the user from use mouse click for like 10 or 20 msec once the user has click?
About the author
#2
I'm guessing you want to prevent the mouse click to more or less 'disable' a button, or functionality within your game so your code has enough time to execute all the way through rather then being executed numerous times in a row ...
if you want to do this, then you can simply add a 'clicked' variable to all your clickable objects, and in your mouse click callback check if it's true, if it is, return, else set it to true and execute your code and set it to false when your codes done ...
this is possibly another solution, though if your looking for a timed solution, Brian's is correct too -- even though it's pseudo-code :)
08/19/2006 (8:32 pm)
Danny,I'm guessing you want to prevent the mouse click to more or less 'disable' a button, or functionality within your game so your code has enough time to execute all the way through rather then being executed numerous times in a row ...
if you want to do this, then you can simply add a 'clicked' variable to all your clickable objects, and in your mouse click callback check if it's true, if it is, return, else set it to true and execute your code and set it to false when your codes done ...
this is possibly another solution, though if your looking for a timed solution, Brian's is correct too -- even though it's pseudo-code :)
Torque Owner Brian Kelly
I'm still new to the Game Builder, so please excuse my psuedo-code:
function yourCallback() { %now = functionThatGetsCurrentTimeInMilliSeconds(); %delta = %now - $lastClickTime; if (%delta > $clickWaitPeriod) { // Handle the click event normally $lastClickTime = functionThatGetsCurrentTimeInMilliseconds(); } }