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.
1 Answer
1Is 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.
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.
– Julien-LyngeYep, agreed. @LucalGPires you can check out the forums here. <strike>I understand you're new to game programming, 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).</strike> Misunderstood Lucas' intentions.
– murkantilismguys 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.
– LucasGPiresAh 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.
– murkantilism
mana -= cost * Time.deltaTime?
– LoiusI don't actually see a question anywhere in there.
– Julien-LyngeSorry 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.
– LucasGPireshow do I do that?
– LucasGPires