Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: ShiverMeSideways on Fri 03/02/2012 06:09:44

Title: Keys under pressure (fixed)
Post by: ShiverMeSideways on Fri 03/02/2012 06:09:44
Hello,

As you might know, I'm working on a platforming engine (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=45261.0) and one of the movement options which is VERY important is that of jump control. In order to implement that, I require to check how hard the player is pressing the jump key. How can I do that in AGS? CAN I do that in AGS? I would need three "grades" of jumping.

Thanks a lot for your help! :)
Title: Re: Keys under pressure - How to check how hard the player is pressing a key?
Post by: Khris on Fri 03/02/2012 06:20:07
Is this a joke? Are you talking about keyboard keys?
There hasn't been a single keyboard in the history of computers that measures pressure. It's a binary thing, 0/1, pressed or not.

The only way of implementing this is using a gamepad's trigger as jump key; this is possible with the agsjoy plugin.
However, what's wrong with the traditional method of pressing the key longer to jump higher, used since possibly 1980?
Title: Re: Keys under pressure - How to check how hard the player is pressing a key?
Post by: ShiverMeSideways on Fri 03/02/2012 06:24:09
I'm sorry Khris for seeming overly thick (because I am), but yeah, I was referring to any way of simulating or implementing jump control with a keyboard, thank you for pointing out a method of doing that. I was having trouble visualizing it and the code.
Title: Re: Keys under pressure - How to check how hard the player is pressing a key?
Post by: Khris on Fri 03/02/2012 06:35:17
Well, all you need to do is accelerate the player a bit longer after they left the ground.
Basically, add a constant amount to their y movement each frame for x frames if the jump button is still pressed.
Title: Re: Keys under pressure - How to check how hard the player is pressing a key?
Post by: ShiverMeSideways on Fri 03/02/2012 09:37:48
Thanks a lot, it worked like a charm! :)