static void Main(string[] args) { Nextlvl.Deserialize(); GameState game = new GameState(); if (Returnlvl.count == 1) { Butter.username = Returnlvl.login; Butter.score = Returnlvl.score; Savescore.Deserialize(); Console.Clear(); game.Run2(); while (true) { if (Butter.gameOver) { GameState.gameover(); } game.DrawScore(); ConsoleKeyInfo consoleKeyInfo = Console.ReadKey(); game.ProcessKeyEvent(consoleKeyInfo); } } else { Console.WriteLine("Champions:"); Savescore.Deserialize(); DesOutput.PrintScore(); Console.WriteLine("Enter username:"); Butter.username = Console.ReadLine(); Console.Clear(); game.Run(); while (true) { if (Butter.gameOver) { GameState.gameover(); } ConsoleKeyInfo consoleKeyInfo = Console.ReadKey(); game.ProcessKeyEvent(consoleKeyInfo); game.DrawScore(); } } }
public void Move() { Clear(); Butter.arrxx.Clear();//Clear old coordinates of snake Butter.arryy.Clear(); for (int i = body.Count - 1; i > 0; --i) { body[i].X = body[i - 1].X; body[i].Y = body[i - 1].Y; } if (Butter.gameOver) { GameState.gameover(); } body[0].X += dx; body[0].Y += dy; for (int i = body.Count - 1; i >= 0; --i) { Butter.arrxx.Add(body[i].X);//getting coordinates of snake's parts Butter.arryy.Add(body[i].Y); } }