private void Initiliaze() { GameIsPlaying = true; Paused = false; AppleEaten = false; Tick = new Stopwatch(); Player = new Snake(TailCoordsList); PlayField = new PlayField(TailCoordsList); Tick.Start(); UpdatePlayField(); }
public void AppleCollisionCheck(int width, int height, Coord appleCoord, PlayField playField, List<Coord> tailCoords) { if (NewHeadCoord.X == appleCoord.X && NewHeadCoord.Y == appleCoord.Y) { if (tailCoords.Count + 1 >= width*height) // No more room to place apples -- game over. GameIsPlaying = false; else { playField.SetAppleField(tailCoords, appleCoord); ExtendSnakeTail(tailCoords); } } }