Пример #1
0
 //Wall Detections
 void isNearWall()
 {
     if (snakeParts[0].Bounds.X < 0)
     {
         mySnake.SetPosition(panel1.Width + 5, snakeParts[0].Bounds.Y);
     }
     else if (snakeParts[0].Bounds.X > panel1.Width)
     {
         mySnake.SetPosition(0, snakeParts[0].Bounds.Y);
     }
     else if (snakeParts[0].Bounds.Y < 0)
     {
         mySnake.SetPosition(snakeParts[0].Bounds.X, panel1.Height);
     }
     else if (snakeParts[0].Bounds.Y > panel1.Height)
     {
         mySnake.SetPosition(snakeParts[0].Bounds.X, 0);
     }
 }