Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: alisa_tana on Mon 01/09/2008 23:43:05

Title: Set Variable = Keypress? [Solved]
Post by: alisa_tana on Mon 01/09/2008 23:43:05
I'm working on a fighting game ( http://www.alisachristopher.us/avatarsd )
and I'm currently writing the bit to allow players to choose their own keys.

I've already got the GUI built for the options page,  and set up my variables to work in the player commands.


but what I don't know how to do is to set a variable equal to the ascii value of a keypress (other than writing an if statement for each possible keypress)

EDIT:
Okay, I figured out how to have the keypress become the variable...

But now I'm stuck with the dilema of having the key that was pressed displayed.  so that after a player chooses the A key (and sets the variable to 65) to have the label in the GUI read as "A".  ??
Title: Re: Set Variable = Keypress?
Post by: Khris on Tue 02/09/2008 04:19:27
char c = 65;
label.Text = String.Format("%c", c);


http://www.adventuregamestudio.co.uk/manual/StringFormats.htm
Title: Re: Set Variable = Keypress?
Post by: alisa_tana on Tue 02/09/2008 04:31:02
AAhhhh.  Wakatta.  Thanks!