Jump High in Relation to Key Hold Duration
Kamazar
Member Posts: 287
I remember there being an entry in the wiki for this but all I find is the simple "accelerate upward for X seconds" solution. How do I get it so the height is related to how long I hold the key? Thx.
Comments
i think you can use a keypress rule instead of a timer setup. but then you'll have to pay close attention to max speed stuff.
When key "space" is pressed:
accelerate up.
If so what did it do?
Set the acceleration on a timer. That way there is a max they can hold it. Then try something like this as the rule
IF
If space key is down
If game. "Jump" (Boolean) = 0
THEN
Accelerate ... (whatever you have)
Change game. "Jump" = 1
Then as another rule.
IF
Actor recieves event collides with (select ground actor, or use the new tag feature)
THEN
change attribute game.jump = 0
This makes it so you can only jump when on land. Or at least in theory it should. That way they can't hover in the air indefinitely. Now this would make it so they hit the side of a platform they could jump again. So you may need a "ground" actor then an actor for the sides of the platforms. That way even just hitting sides or even walls won't let them jump.
Lemme know how this works out for ya. Again it should work with some tweaking, but it's theory only, so who knows.
EDIT: When I said up in the previous post, I meant whatever you use to make it go up. Just didn't feel like typing it all out
-JGary
i like that method jgary321, especially the separating the walls from the ground. i could see using that method to create gameplay where only certain surfaces are 'jumpable' as part of the game...nice job.
hey k, post the rules. fresh eyes do wonders.
-JGary
http://img233.yfrog.com/img233/4576/gsjump.png
Oh, and JGary, I tried that theory out on the original build by changing the boolean attribute to an integer attribute, and setting up a counter display. It alternated from 0 to 1, so it can't be what you said, but I'll try it again with the new build.