how you set up, when i hold down space key certain amount of time to charge my jump, it will jump certain amount of feet
When space bar is pressed,
set a boolean variable to true,
start or reset a scene or object timer.
If boolean variable is true and space bar is released,
set boolean to false,
save the timer value into a number variable.
delete timer or reset and pause.
You can then use that number variable to compute for the jump distance.
At the moment, I don’t have access to my pc, probably until a couple of days. But for the meantime, I’ll just try and write the events here as best I can.
event 1
-condition:
at beginning of scene
-action:
start or reset timer jumptime
pause timer jumptime
event 2
-condition:
if jumptime is false
space key is pressed
-action:
set jumptime to true
unpause timer jumptime
event 3
-condition:
if jumptime is true
space key is not pressed
-action:
set jumptime to false
set variable jumpdistance = timer jumptime value x N
start or reset timer jumptime
pause timer jumptime
(here you may insert the jump action or perhaps set up another event with either another timer or use a tween.)
The “N” there is a factor for how far you’d like the jump to be for every time unit value.
Like if you want the jump to be 100 pixels for a five second charge, set N to be 20.
So then, jumpdistance is the number variable you are going to use for how far the jump goes.
I hope you can make sense of this else I might not be much help until I get to my pc.
Or perhaps one of the pros might come along and present a better way.
Good luck.
Set your jump to 50+JumpVar
Now when
Condition
Space is pressed
|| Sub Evnet1
|| Trigger once <> Change JumVar Set to 0
|| Sub Event2
|| Value of JumpVar is LESS THAN Something <> Change JumpVar Add 1
Next event
Condition
Space key is released
Action
Simulate Jump Key
Now you may set jump height to 50+JumpVar or 174+JumpVar
This 50 or 174 should be your default jump height
Where in event you add 1 to JumpVar you also need to modify that to like 2 or 0.5 or whatever
And in condition where Value of JumpVar is LESS TAHN
This is to limit how high that JumpVar can go
So you don’t hold space for 5 mins and send your player to the moon
Best idea would be to print JumpVar to text object to see how fast it is charging and at what value how high you jump