KeyDown Event Once only

Talk about making games.

KeyDown Event Once only

Postby ingsan » Fri May 28, 2004 1:04 pm

Hello everyone !

Q : How can a KeyDown Event occur only ONCE ?
R : Well, actually after assigning your KeyDownEvent with an Action in Script, you add EVENTDISABLE to disable your actual Keydown Event.

:roll: Poor me !
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

Postby ingsan » Fri May 28, 2004 1:07 pm

Oh ! I forgot !
How can I point to "any letter" of the alphabet using one and only code ? That is, whenever I click on G, the letter G appears, or whenever I click on Z, then Z appears. Do I have to declare the KeyDown Event for EACH letter ?
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

Postby makslane » Fri May 28, 2004 3:23 pm

Use the getLastKey and getKeyText functions

To see how works, go to:

Help -> Get Newest Tutorials

After update, run:

Help -> Script -> Catch any pressed key
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby ingsan » Fri May 28, 2004 4:07 pm

Wow that's really amazing ! Have you seen my tutorial concerning the False input text ? So, you've also seen that I've written each and every single letter of the alphabet :oops:
But one last thing. I see that when you click on "space", what is written is actaully SPACE. Is there a way to replace that with an Empty space instead of SPACE ? Remap or something ? :mrgreen:
Or can we limit the keys to only alphabetical letters ?
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

Postby ingsan » Fri May 28, 2004 5:15 pm

Oh I found a little solution for limiting the keys to specific ones only :idea: Instead of having a True Type Font, use an ASCII file with alphabetical Letters ! This limits the keys to ONLY alphabetical letters

However there is some problem with SPACE and RETURN keys :?
For Space, maybe should I put a space somewhere in my ASCII files.
But for ENTER ? Maybe add an Action on it to hide the bug :)

What do you think ?
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

Postby makslane » Sat May 29, 2004 10:14 pm

Use something like this:

if(getLastKey() == KEY_RETURN)
{
//Your action...
}
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby ingsan » Mon May 31, 2004 9:28 pm

CooL 8)
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron