• 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 /
avatar image
0
Question by LucasGPires · Mar 22, 2013 at 05:32 PM · mousemonodevelop

Help me guys... spend mana with certain actions

Hello Guys Help me ... I'm new in the field of game programming. And I've learned a lot here. But I'm having trouble creating a script. Next ... My character has mana. And there are 3 factors that spend mana. First run pressing shift Second, using the mouse (left) with magic (magic is an animation) Third: the mana recovers life with the mouse button (Right) I have to make a script that runs it all.

Comment
Add comment · Show 4
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 Loius · Mar 22, 2013 at 05:53 PM 0
Share

mana -= cost * Time.deltaTime?

avatar image Julien-Lynge · Mar 22, 2013 at 05:59 PM 2
Share

I don't actually see a question anywhere in there.

avatar image LucasGPires · Mar 22, 2013 at 07:37 PM 0
Share

Sorry if I was not clear. I want a script (javascript) when I click the left mouse button he spend mana, when I click on shift spend mana, and when I click with the left mouse button he spend the mana and regain life.

avatar image LucasGPires · Mar 22, 2013 at 07:37 PM 0
Share

how do I do that?

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by murkantilism · Mar 22, 2013 at 07:41 PM

Is there a real question here? Are you just asking for high level advice?

UnityAnswers is not a place to come and say "Please do all the work for me & write me a script that does X Y Z."

My high level advice is:

  • Use Input.GetKeyDown(KeyCode.Shift) (see documentation), Input.GetMouseButtonDown(0) (see documentation) to find out when the user does actions that cost mana.

  • Each time the user does actions that spend mana, subtract X amount from the variable that keeps track of mana.

Edit: Once you try to write the code yourself, if you have any problems, then you can come here to ask a question & get help.

Comment
Add comment · Show 6 · Share
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 Julien-Lynge · Mar 22, 2013 at 07:42 PM 0
Share

BTW: There is a place on the forums to request work from the community. However, you'll likely have to pay for it. There aren't many people that want to create elements of your game for you for free.

avatar image murkantilism · Mar 22, 2013 at 07:46 PM 0
Share

Yep, agreed. @LucalGPires you can check out the forums here.

I understand you're new to game program$$anonymous$$g, but it's unfair for you ask others to create parts of your game for you for free. A lot of people dedicate years of their lives and thousands of dollars in college tuition to learn Computer Science & Game Design (myself, for example).

$$anonymous$$isunderstood Lucas' intentions.

avatar image LucasGPires · Mar 22, 2013 at 07:55 PM 0
Share

guys relax

I must have expressed myself badly. I'm not loose and do not want anyone to do anything for me. I wanted to help in logic as our friend did murkantilism.

The next will be more transparent. clearer.

but anyway thanks.

avatar image murkantilism · Mar 22, 2013 at 08:00 PM 1
Share

Ah okay, sorry that I misunderstood.

Yea see my advice for the logic. One thing I forgot to mention is use Animation.Play() (see documentation) when the user left clicks to play the magic animation.

avatar image LucasGPires · Mar 22, 2013 at 08:01 PM 0
Share

Thanks Guys

sorry something. I had no such intention.

thank you!

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

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

13 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

Related Questions

Multiple Cars not working 1 Answer

SideScrolling Mouse Pointer Aim - Help 0 Answers

Monodevelopement not responding? 2 Answers

Mouse flying 0 Answers

Error cs0200, please help i´m novice 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