help me with changing cs into js and help with a little js/cs knowledge for a beginner :)

Hey, I was wondering if anyone could help me with changing this into js.

I’m working on trying to adjust my targets health by x amount when OnTriggerEnter.

I want to call something similar or exactly like "AdjustCurrentHealth(-AMOUNT);
I would also like someone to explain what is supposed to go in the “curly braces” () in a js function like in cs its a type? and then its name?
So in the cs one when you call the function the int is the amount and then when you put the code in it for what it does you use the name?

I’m not sure if you will understand me it’s like 3 am :slight_smile:

This is what I have from an earlier project. (BurgzergArcade xD)

public void AdjustCurrentHealth(int adj) {
		curHealth += adj;
}

This is my attempt at converting it to JS for my new project.
hp is the same as curHealth.

function AdjustCurrentHealth(int adj) {
hp += adj;
}

1 Answer

1

it would be

function AdjustCurrentHealth(adj : int) {
   hp += adj;
}