- Home /
Other
Max Mouse Clicks Question
Hello guys, Im new to scripting so treat me like a dummy i dont care. My question is in my game the goal is to bring down towers(2D) within a max number of mouse clicks(the player clicks the mouse to drag the objects). So what script would limit the number of mouse clicks? {Do you understand my question)? and if you can put a way to show how many clicks are left as a gui? please. Thanks for your help. Im not meaning to ask anyone to make me a script but i have no clue how to so if someone could make one and them explain it, it would help? thanks again.
[1]: /storage/temp/20363-gamepic.jpg
This isn't a site to have people write code for you, but it sounds like you want to provide the player a finite number of clicks with which to spend by clicking on some game objects which, if enough clicks were spent on one object in particular, would 'come down'.
It's very simple. You'd want to start off by deter$$anonymous$$ing how many the max click count was. Then, each time you clicked, you'd decrement that counter by one. If there were no more clicks left then you'd know to end the game (or whatever you do when the player is out of clicks). It could be done in single function.
PSUDO CODE:
var clicks = 20;
f()
{
if (--clicks == 0)
end the game.
}
If you want to learn to code, you are on the wrong website. There are a ton of places to learn coding, especially coding using C# or UnityScript, but this is a website for specific technical questions, not "how do I do this" questions