I'm using Javascripts, but my FPSController is the default prefab made with C#, so I don't really know if I can directly link JS with C#.
That aside, you begin with 100 Health, I've made a way to gain and lose health, but the mechanic I want to add is, the less health you have, the higher your jumps are, and when you gain more than 100 (Cap at 200) your jumps are lower.
----------
var JumpModif : int = 0;.
//In the fuction Update
if (Input.GetButtonDown("Jump"))
{
Parent_Player.GetComponent.().velocity.y = Parent_Player.GetComponent.().velocity.y + JumpModif;
}
----------
this piece of code is what I made in order to add more distance in the character's jumps and the functions responsible of add or substracting JumpModif works fine.
The problem is I either fly infinitely or it simply doesnt work.
Can anyone help?
Thanks!
↧