• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed Jan 08, 2014 at 06:15 AM by Benproductions1 for the following reason:

Other

avatar image
0
Question by chief001 · Jan 08, 2014 at 04:31 AM · click objectsclick to movemouse drag

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

gamepic.jpg (224.7 kB)
Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image iwaldrop · Jan 08, 2014 at 04:42 AM 1
Share

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.
 }
avatar image Benproductions1 · Jan 08, 2014 at 06:14 AM 0
Share

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

0 Replies

  • Sort: 

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

20 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

how can i make a ball bounce when i click on it 1 Answer

How do I let the player interact with objects close to them? 1 Answer

Help Ship Controll 0 Answers

how can i get a pause screen to work 0 Answers

Trying to make Collider Activate with key code 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges