- Home /
How would you code disabling Mouse Left Click, after clicking it once?
Here is my scenario: Im currently studying on Udemy, and I know I should't be jumping ahead, but I wanted to try to try figuring out the code to test myself. The game is the block breaker game (where you have a paddle, move it around with your mouse on a fixed horizontal plane, and bounce a ball around). Anytime I click, after initially launching the ball, it still gets "launched" from it's new Vector2 (which is cool, so I understand how Double Jumping works).
My question is: How do I disable the "double jump" or the "on click launch", after I have already launched the ball into the air?
My current attempt is: I made a "bool bouncingAround = false;" under Start(), a "bouncingAround = true;" under the LaunchOnMouseClick(), and, so far, an "if (bouncingAround = true)" under Update(), with no commands yet. I hope i'm on the right track. Please, and thank you for your help and or criticism!
Answer by Happeloy · Feb 22, 2019 at 09:49 AM
It would be easier if you go ahead and post the code you have at the moment. One thing that is not correct however is if(boundingAround = true)
, it should be if(bouncingAround == true)
, with the double equal sign. A single equal sign is used to assign stuff ( int a = 3;
), while a double equal sign is used to compare stuff.
You approach seems to be correct, before launching your ball, check if bouncingAround is true. If it is not, go ahead and launch the ball, and set the bool to true.
Your answer
Follow this Question
Related Questions
disable mmb and rmb raycast on ColorPicker 0 Answers
How to Activate Script in another Object? 1 Answer
How to disable click to move on interface elements ? 0 Answers
Disabling clicking on advertisments 1 Answer
In need of an OnWillDisable() event 2 Answers