예제 #1
0
파일: Hud.cs 프로젝트: Blind238/GameProject
        public Hud(Game game, int maxLives)
            : base(game)
        {
            SetScale(GameLogic.GetInstance().GetScale() * 3f);
            SetTexture(Resources.frame);
            SetMovingBehaviour(new DontMove((MovingObject)this));

            SetPosition(new Vector2(game.GraphicsDevice.Viewport.Width * 0.6f, 0f));

            for (int i = 0; i < maxLives; i++)
            {
                PlayerShip ship = new PlayerShip(game);
                ship.SetMovingBehaviour(new DontMove(ship));
                ship.SetScale(GameLogic.GetInstance().GetScale()/2);
                ship.SetPosition(new Vector2((GetPosition().X - Bounds().Width) + i * (ship.Bounds().Width * 1f) , ship.Bounds().Height * 0.3f));
                ship.Disable();
                game.Components.Add(ship);
                ships.Add(ship);
            }
        }
예제 #2
0
        private void Start(Game game)
        {
            _game = game;
            _enemies = new ArrayList();
            _enemyProjectiles = new ArrayList();
            _players = new ArrayList();
            _playerProjectiles = new ArrayList();
            _powerUps = new ArrayList();
            PlayerShip _playerShip = new PlayerShip(_game);
            _game.Components.Add(_playerShip);
            _players.Add(_playerShip);

            CreateHud(game);
            Levels.LoadLevel((int)Levels.ELevel.One);
        }