EDIT: SOLVED;
All i had to do was to add:
csharp** **public JumpBars playerJumpScript;** **
to the PlayerControler and add
playerJumpScript.<call method that removes jump energy>();
to the PlayerControler
as well as create method of removing energy from the JumpScript Lesson learned!
First of all, i have asked this question before on âAnswersâ, but it has been waiting for moderation i am new to forums and i dont know how everything works, so if i should close the question somehow, pelase, let me know how.
TL;DR at the end.
Hello world!
Hi. Okay, so first of all - please, understand me. I have no coding knowledge, no idea whats going on on unity. No background in anything related to coding.
I know that people odnt like whne questions that have already been answered are asked, however, i did not find any specific help on youtube, google or unity forums.
My situation:
I have created âroll-a-ballâ game, and decided to add certain features. First of, after completing the tutorial series from youtube, i decided to make my ball JUMP. Had some problems wiht âOnColiisionStayâ âisGroundedâ, watched some more tutorials, decided to use âRayCastâ.
Now, i have added HP and ENERGY bar (took me like 8 hours x.xâ'). but its in different script.
Now, the good part is, the playercontroller, which has âJUMPâ void checks for the information on player energy by checking âpublic static float energyshownâ from JumpEnergy script, that also shows the amount of energy left on GUI.
I also made some adjustments and it wont allow me to jump if energy is <75.
BUT, i want to make it so âJumpEergyâ script, to recignize when âPlayerControllerâ uses âvoid Jumpâ command, and then it would adjust the amount of energy accordingly. I know how to add/remove amount oif player energy, but i canât think of how to check when âJumpâ called from another script. :c
Tl;DR;
Class 1
Void âjumpâ
need to let
Class 2 know when is âjumpâ from âclass1â used.
If anyone could help me understand how this works - i would be very thankful!