
Originally Posted by
Fahad786
I am not game programmer and I call myself a newbie into programming with that being said it motivates me to learn more.
You have asked how can we make one thats what i had asked too.I had searched on google and found they use xna for 2d and unity for 3d but mostly they use unity3d and i would use c# if you say what language because it has builtin powerful tools that you can use to create buttons,interface and etc.
.I created this example using c# language in visual studio IDE
Basically what I did in the hangman example I mean what was most difficult part was creating an algorithm for replacing asterik (*) on answer textbox with typed alphabet.
Here is the summary of what my algorithm does and I do not call it efficient.
After you click 2 player game at tab 2(also called setings),following things happen in my algorithm:
1>Create array with maximum length of 20
2>initializing or setting all of the array's values to -1 using for loop using length of answer from tab 2(settings)
3>Initializing asteriks on textbox using for loop using the length calculated at tab 2(settings)
Now when you click any alphabet which is given at tab 3 following things happen:
1>using Type type = sender.GetType();
I get button as its name and text as "A" for example which i store it in my variable.
Now using my function called check,which checks weather the alphabet stored in one of the variables matches with the answer variable or not if yes then following things happen:
1>Now using for loop with < length as condition inside which it checks again using substring method weather it contains the typed alphabet or which is stored or not..if yes then save index meaning assign current element in aray with current iterator value.
2>Now another loop runs which has condition of run till current element is not equal to -1.
3>Now with insert function.insert at the particular asterik place with the given index that is not equal to -1 and replace it with stored variable.
4>using remove function remove asterik at the same place but with 1 increament.
5>finally replace the stored answer with asterik from stored variable.
Ta Dah done.