Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (NewbieZorro, TipmyPip, 1 invisible), 19,045 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
keyboard input #151921
09/03/07 01:42
09/03/07 01:42
Joined: Dec 2006
Posts: 18
S
soraga Offline OP
Newbie
soraga  Offline OP
Newbie
S

Joined: Dec 2006
Posts: 18
Hallo, I have some jumping code I am working on, and when I push space, my model jumps, as planned, and when I let go, the model falls, as planned. However, if I keep holding down the space key, the model keeps going up and up and up forever, until I let go, then the model falls again.

Is there anyway to make the space key stop inputting after a second or so? So that when I push the space key and key_space == 1, space_key will == 0 after about 1 second, regardless of holding down the key or not. Nothing Ive tried has worked.

Thanks

Re: keyboard input [Re: soraga] #151922
09/03/07 03:51
09/03/07 03:51
Joined: Sep 2003
Posts: 733
Whitefish, Montana
JazzDude Offline
User
JazzDude  Offline
User

Joined: Sep 2003
Posts: 733
Whitefish, Montana
Is it in a while loop? If so, change while to if.
return(); might also fix it.

Re: keyboard input [Re: JazzDude] #151923
09/03/07 10:32
09/03/07 10:32
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl
var key_spaceon;

function jump
{
while(1)
{
if(key_space == on && key_spaceon <=60)
{
//my.x +=1;
key_spaceon += 1 *(time_step/time_step);
}
if(key_space == of)
{
key_spaceon = 0;
}
// ore
if(key_space == of && key_spaceon >1)
{
key_spaceon -= 1*(time_step/time_step);
}


"empty"
Re: keyboard input [Re: flits] #151924
09/03/07 15:27
09/03/07 15:27
Joined: Dec 2006
Posts: 18
S
soraga Offline OP
Newbie
soraga  Offline OP
Newbie
S

Joined: Dec 2006
Posts: 18
Thank you, I will try both later today.

Re: keyboard input [Re: soraga] #151925
09/03/07 21:49
09/03/07 21:49
Joined: Dec 2006
Posts: 18
S
soraga Offline OP
Newbie
soraga  Offline OP
Newbie
S

Joined: Dec 2006
Posts: 18
Hmm, niether seem to work. I know there is some conflict around my if and while arguments. I am going to abandon this for now and come back to it, as jumping is unnecesary at this stage of my project.

Thanks

Re: keyboard input [Re: soraga] #151926
09/04/07 05:15
09/04/07 05:15
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline
Serious User
vlau  Offline
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
Code:

function jump()
{
// jump code
//.....
}

on_space = jump;



To let your model jumps again, you need to release
and press the spacebar again.


Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1