Make your very own game using Visual C++ Express Edition (or in any PL)

I’m sure you all have heard of “Guess the number” game. Well who hasn’t. It’s practically in every programming book of every programming languages by every programming authors. The reason perhaphs is you can actually make billions of games from it. All you need to do is make up some weird stories with number guessing involved in there then you are good to go. Here are some examples:

1. Mind Reader Game

Here's the code:
  1. #pragma endregion  
  2.   //declare two variables. intrandom will handle the generated random numbers  
  3.   //intcounter will handle the number of incorrect guesses  
  4.    int intrandom;  
  5.    int intcounter;  
  6.  private: System::Void guessbutton_Click(System::Object^  sender, System::EventArgs^  e) {  
  7.   //create a random object named randgen based on the Random class  
  8.      Random^ randgen=gcnew Random();  
  9.      //generate a random number from 1 to 31 and store the generated number into a variable named intrandom  
  10.      intrandom=randgen->Next(1,31);  
  11.      //if the date inputted by the user is lesser than the generated number  
  12.      if (int::Parse(this->datetextBox->Text)<intrandom) {="" display="" this="" message="" this-="">statuslabel->Text="Sorry. Your guess is wrong. Perhaps you need some crystal ball?";  
  13.    //if its lesser than the generated number obviously the user has guessed it wrong so we acummulate the value  
  14.    //of the intcounter variable.  
  15.      intcounter=intcounter + 1;  
  16.      }  
  17.    //if its greate than the generated number  
  18.      else if (int::Parse(this->datetextBox->Text)>intrandom)  
  19.      {  
  20.       //display this message  
  21.       this->statuslabel->Text="It's not what the audienced had picked.Perhaps you need some chant or something.";  
  22.    //if its greater  than the generated number obviously the user has guessed it wrong again so we acummulate the value  
  23.    //of the intcounter variable.  
  24.       intcounter=intcounter + 1;  
  25.      }  
  26.      else  
  27.      {  
  28.     //if the user has guessed it right. display the follwing message and disable the textbox.  
  29.       this->statuslabel->Text="You guessed it right. Congratulations! You are now a fullfledge magician.";  
  30.       this->datetextBox->Enabled=false;  
  31.      }  
  32.     //if the user has guessed it wrong thrice   
  33.      if ( intcounter>2)  
  34.      {  
  35.     //dsiplay this then disbale the textbox.  
  36.       this->statuslabel->Text="You have failed the test. Your remaining magic powers will be taken from you.";  
  37.       this->datetextBox->Enabled=false;  
  38.      }  
  39.   
  40.     }  
  41. };  
  42. }  
  43.   
  44.   
  45.   
  46. </intrandom)>  


2. Oil Magnate Game

Here's the code:
  1. #pragma endregion  
  2. //I wont add comments on this one coz it’s practically the same code. we only //added random responses from the user if the answer is the answer is wrong  
  3.    int intrandom;  
  4.    int intcounter;  
  5.  private: System::Void guessbutton_Click(System::Object^  sender, System::EventArgs^  e) {  
  6.    
  7.      Random^ randgen=gcnew Random();  
  8.      
  9.      intrandom=randgen->Next(20,50);  
  10.      
  11.      if (int::Parse(this->agetextBox->Text)<intrandom) {="" intrandom="randgen-">Next(1,2);  
  12.   
  13.      if (intrandom==1)  
  14.      {  
  15.      this->statuslabel->Text="Im flattered but I'm not that young.";  
  16.      }  
  17.      else  
  18.      {  
  19.      this->statuslabel->Text="I have a feeling  that you are just making fun of me.";  
  20.      }  
  21.   
  22.         intcounter=intcounter + 1;  
  23.      }  
  24.     
  25.      else if (int::Parse(this->agetextBox->Text)>intrandom)  
  26.      {  
  27.    
  28.      intrandom=randgen->Next(1,2);  
  29.   
  30.      if (intrandom==1)  
  31.      {  
  32.      this->statuslabel->Text="That's rude, I'm not that old.";  
  33.      }  
  34.      else  
  35.      {  
  36.      this->statuslabel->Text="Are you stupid or something?";  
  37.      }  
  38.    
  39.       intcounter=intcounter + 1;  
  40.      }  
  41.      else  
  42.      {  
  43.      
  44.       this->statuslabel->Text="Congratulations! You have won the 3 billion dollars.";  
  45.       this->agetextBox->Enabled=false;  
  46.      }  
  47.    
  48.      if ( intcounter>2)  
  49.      {  
  50.    
  51.       this->statuslabel->Text="You have used the maximum number of guesses and won nothing.";  
  52.       this->agetextBox->Enabled=false;  
  53.      }  
  54.   
  55.     }  
  56. };  
  57. }  
  58.   
  59. </intrandom)>  
So there...enjoy game programming :)

Say "Hello" to Blender and Flash

I have not written any programming guide in a while now coz I’m sort of in a “hiatus” or something. But I’ll post some as soon as my dopamine level rises up.

Meanwhile, if you are interested in things that move i.e. computer graphics, some of the great computer graphic softwares out there are Blender 3D and Adobe Flash.

Here are some of the basic animations that you can do with flash. These are made by my former students, I captured them using KRUTS and edited using PD11. Enjoy!



Here are some of the basic blender animations that you can do with blender. These are made by my former apprentices, you’ll see their names at the end of the movie. Anyways, enjoy!