コード例 #1
0
ファイル: SnakePit.cs プロジェクト: mikand13/school_portfolio
        protected override void Initialize() {
            Width = Console.WindowWidth;
            Height = Console.WindowHeight;

            const int playerOffset = 10;
            var playerCount = 1;

            var random = new Random();
            GameObjects.Add(new Snake(new Vector2D(random.Next(0, Width - playerOffset), random.Next(0, Height - playerOffset)), playerCount++));
            GameObjects.Add(new Apple(new Vector2D(random.Next(0, Width), random.Next(0, Height)), 10));
            GameObjects.Add(new Level(Width, Height));

            StartMenu = new SnakeStart();
            GameOver = new SnakeEnd();
            InputManager = new SnakeInput();
        }
コード例 #2
0
ファイル: SnakePit.cs プロジェクト: abztracta/westerdals
        protected override void Initialize()
        {
            Width  = Console.WindowWidth;
            Height = Console.WindowHeight;

            const int playerOffset = 10;
            var       playerCount  = 1;

            var random = new Random();

            GameObjects.Add(new Snake(new Vector2D(random.Next(0, Width - playerOffset), random.Next(0, Height - playerOffset)), playerCount++));
            GameObjects.Add(new Apple(new Vector2D(random.Next(0, Width), random.Next(0, Height)), 10));
            GameObjects.Add(new Level(Width, Height));

            StartMenu    = new SnakeStart();
            GameOver     = new SnakeEnd();
            InputManager = new SnakeInput();
        }