Пример #1
0
        public Game()
        {
            GameFiles  = new GamesFiles();
            ClientSize = new Size(GameFiles.CurrentLevel.Background.Width,
                                  GameFiles.CurrentLevel.Background.Height);
            DoubleBuffered = true;

            CurrentGameInfo = new GameInfo();
            CurrentLevel    = new Level(GameFiles.CurrentLevel);
            var timer = new Timer();

            timer.Interval = 15;

            KeyPressing();
            TickCommands(timer);
            timer.Start();

            Paint += (sender, args) =>
            {
                if (CurrentGameInfo.IsLevelCompleated)
                {
                    Ads.LevelCompleted(args.Graphics);
                }
                else if (CurrentGameInfo.IsPlayerAlive)
                {
                    Drawer.DrawAll(CurrentLevel, args.Graphics);
                }
                else
                {
                    Ads.YouDied(args.Graphics);
                }
            };
        }
Пример #2
0
        public Player CreatePlayer()
        {
            var gamesFiles = new GamesFiles();
            var level      = new Level(gamesFiles.CurrentLevel);

            return(level.Player);
        }