public GameScene() : base(nameof(GameScene)) { _snake = new Entities.Snake(_apples); _snake.OnDeath += OnSnakeDeath; _snake.OnAppleEaten += OnAppleEaten; SpawnApple(); }
public static void Initialize(int size) { Size = size; Snake = new Entities.Snake(new Position { X = 5, Y = Size / 2 }); var foodInitialRandom = new Random(); Food = new Food(new Position { X = foodInitialRandom.Next(0, Size), Y = foodInitialRandom.Next(0, Size) }); Renderer = new BoardRenderer(Size); Renderer .AddBlocks(Snake.GetBlocks(), 0) .AddBlock(Food.GetBlock(), 1) .Render(); }