- Home /
AdjustCurrentHealth
Hello guys, well I have been working on a melee combat code. I was checking out a video of BurgZergArcade "Melee Attack"on how to create a very simple Melee attack script and I saw a function that would be really helpfull in my script, the function was:
public void AddjustCurrentHealth (int adj){
curHealth == adj;
}
Then when he needs to quit 10 points, he just wrote:
AddjustCurrentHealth(-10);
How can I write this function in JS?
Answer by syclamoth · Apr 16, 2012 at 02:30 AM
function AddjustCurrentHealth (adjustment : int)
{
curHealth += adjustment;
}
Also, I'm pretty sure that C# code is wrong. You shouldn't be evaluating curHealth, you should be changing it.
In any case, burgZerg annoys me with his deliberately mis-spelled names everywhere...
You should learn how to translate between the two main languages used in Unity. While I wholeheartedly recommend that you use C# exclusively (it is a comprehensively better language, but let's not get into that), the process of translation is really not hard and will teach you a bit about the details of them both.
Thank you, I know how to translate the code but I did not saw that it was += not ==, (my mistake) I also feel annoyed by BurgZergArcade but he is a good programmer.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
private Vector3 function? 2 Answers
calling c# function from a js file.. 1 Answer
Converting this JS code to C# 1 Answer