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; }
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()); }
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(); }