Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

How to change jump height depending on your health

$
0
0
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!

Viewing all articles
Browse latest Browse all 1875

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>