示例#1
0
 public bool CheckCollision(Snake snake, Food food)
 {
     if (snake.PositionX == food.PositionX && snake.PostitionY == food.PostitionY)
     {
         snake.Eat();
         food.Eaten();
         return true;
     }
     else
         return false;
 }
示例#2
0
        static void Main()
        {
            Snake snake;
            Food food;
            Enviroment enviroment;
            snake = new Snake();
            food = new Food();
            enviroment = new Enviroment();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
示例#3
0
        public Form1()
        {
            InitializeComponent();
            snake = new Snake();
            food = new Food();
            gamecontrol = new GameControl();
            enviroment = new Enviroment();
            food.CreateFood();  // hogy a legelején legyen kaja

            // dupla bufferelés
            SetStyle(ControlStyles.DoubleBuffer |
                ControlStyles.UserPaint |
                ControlStyles.AllPaintingInWmPaint,
                true);
            UpdateStyles();
        }