Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Stopping Input From a Key

Author
Message
tlalte uctli
21
Years of Service
User Offline
Joined: 2nd May 2004
Location:
Posted: 9th Dec 2004 10:07
Hey all!

Just a quick question here. I am making a game and using the Nuclear Glory Collision system, so I am using that for gravity because I thought it would be simple to make a character jump. I thought I would do this by using one key that would move the player up, and then letting the "automatic" (i.e. I don't have to do it, THANKS NG!) gravity pull it back down. The problem I am having results from the key being held.

If it is held, the player object in the game just continues to rise like a ballon rather than coming back down after a short interval of time like I would like it to. I've racked my brains trying to figure this out and have tried several things, like testing for the initial height of the object and then terminating the rise of the object after it has reached an ordained "jump height"; but none of my ideas have worked.

There must be a simple way of stopping input from my "jump" key, but I don't know what it is. Do any of you?

PS: My code for the "jump" is contained below.


:: it is over! all your base are belong to us! ::
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 9th Dec 2004 10:24
Here's how I do it... Pretty simple really.



That was pulled straigh out of my common routines that I have put up as open source, here; http://forum.thegamecreators.com/?m=forum_view&t=43824&b=6

Hope I Helped.
Jess.


Team EOD :: Programmer/All-Round Nice Guy
Aust. Convention!
Maleck
21
Years of Service
User Offline
Joined: 12th May 2004
Location: US
Posted: 9th Dec 2004 12:50
Here is another option I have used



Either one should work fine for you.
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 9th Dec 2004 14:01
However, Maleck, with that, would it not stop program execution untill you have released the key?

Jess.


Team EOD :: Programmer/All-Round Nice Guy
Aust. Convention!

Login to post a reply

Server time is: 2025-06-05 18:57:58
Your offset time is: 2025-06-05 18:57:58