This is a test your visual memory game. Run the game and memorize the location of each image on the screen and then click back to match the image.
Sample code:
public void showpic() // show each picture if clicked by computer...
{
gn = new generate();
for (int k = 0; k < global.siz; k++)
{
switch (j[k])
{
case 1:
plym1();
gn.pp1.Visible = true;
gn.pp1.Image = global::WindowsFormsApplication3.Properties.Resources.christmas_ball_1;
gn.pp2.Visible=false;
gn.pp3.Visible = false;
gn.pp4.Visible = false;
gn.ShowDialog();
break;
case 2:
plym2();
gn.pp2.Visible = true;
gn.pp2.Image = global::WindowsFormsApplication3.Properties.Resources.christmas_ball_2;
gn.pp1.Visible = false;
gn.pp3.Visible = false;
gn.pp4.Visible = false;
gn.ShowDialog();
break;
case 3:
plym3();
gn.pp3.Visible = true;
gn.pp3.Image = global::WindowsFormsApplication3.Properties.Resources.christmas_ball_3;
gn.pp2.Visible = false;
gn.pp1.Visible = false;
gn.pp4.Visible = false;
gn.ShowDialog();
break;
case 4:
plym4();
gn.pp4.Visible = true;
gn.pp4.Image = global::WindowsFormsApplication3.Properties.Resources.christmas_ball_5;
gn.pp2.Visible = false;
gn.pp3.Visible = false;
gn.pp1.Visible = false;
gn.ShowDialog();
break;
}
}
}
Random r = new Random(); // generate random number between 1 to 4
a = r.Next(1, 5);
while (i != global.siz)
{
j[i] = 0;
a = r.Next(1, 5);
{
j[i] += a;
No comments :
Post a Comment