I’m making a highscorelist for my XNA game. I would like to make it so that the user can input their name (maximum 6 characters and only characters a-zA-Z).
Does anyone know how I can do this? Popup?
I did Google and got some GUIDE stuff, but i cant get it to work 🙁
Check this link for how to store the data.
http://www.xnawiki.com/index.php?title=How_do_I_handle_high_scores%3F
As for the conditions, maximum 6 characters and only characters a-zA-Z, a simple regex on the input would do it.
Regex playerName = new Regex("^[a-zA-Z]{1,6}$");^means “begin matching at start of string”[a-zA-Z]means “match lower case and upper case letters a-z”{1,6}means “match the previous item (the character class above) 1 to 6 times”$means “only match if cursor is at end of string”