Gamestudio Links
Zorro Links
Newest Posts
Z9 getting Error 058
by k_ivan. 04/25/26 19:13
ZorroGPT
by TipmyPip. 04/25/26 16:09
Stooq now requires an API key
by jcl. 04/13/26 09:42
Strange "Alien" Skull created with >Knubber<
by NeoDumont. 04/10/26 18:58
400 free seamless texture pack downl. here !
by NeoDumont. 04/08/26 19:55
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
1 registered members (Quad), 3,790 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
valino, juergenwue, VladMak, Geir, ondrej
19209 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Key nur einmal aufrufen #249874
02/04/09 18:22
02/04/09 18:22
Joined: Oct 2005
Posts: 612
Inari Offline OP
User
Inari  Offline OP
User

Joined: Oct 2005
Posts: 612
Ich habe folgenes Problem, wenn ich eine Taste drücke wird
die darin erhaltene Funktion x mal aufgerufen.

wie schreibe ich es am besten das die Funktion nur
einmal aufgerufen wird und erst wenn ich die Taste los lasse und diese wieder drücke erneut ausgeführt wird?

Inari

Re: Key nur einmal aufrufen [Re: Inari] #249890
02/04/09 18:59
02/04/09 18:59
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
on_KEY = function;

Bsp:
on_a = help_inari;

this should call the function only once when the key was pressed.
note: this button declarations/defines have to happen in a function when you use lite-C. example: put them in main

Re: Key nur einmal aufrufen [Re: Xarthor] #249905
02/04/09 19:49
02/04/09 19:49
Joined: Feb 2006
Posts: 385
Oldenburg,Germany
Ralph Offline
Senior Member
Ralph  Offline
Senior Member

Joined: Feb 2006
Posts: 385
Oldenburg,Germany
Es geht auch außerhalb der Main, unzwar so:
Code:
if(key_x==1){
   while(key_x==1){wait(1);}
   // jetzt mache ich was ^^
}


MFG Ralph

Re: Key nur einmal aufrufen [Re: Ralph] #250255
02/06/09 21:52
02/06/09 21:52
Joined: Jul 2007
Posts: 959
nl
F
flits Offline
User
flits  Offline
User
F

Joined: Jul 2007
Posts: 959
nl

ore for inside a loop

Code:

var key_a_r;

while(1)
{
if(key_a_r && key_a)
{
key_a_r = 0;
//do_somthing;
}
if(!key_a)
{
key_a_r = 1;
}

//loop isnt disturbed;
c_move(...
wait(1);
}




"empty"

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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