Ejemplo n.º 1
0
        double _speed = 512; // pixels per second

        #endregion Fields

        #region Constructors

        public PlayerCharacter(TextureManager textureManager, BulletManager bulletManager)
        {
            _bulletManager = bulletManager;
            _bulletTexture = textureManager.Get("bullet");

            _sprite.Texture = textureManager.Get("player_ship");
            _sprite.SetScale(0.5, 0.5); // spaceship is quite big, scale it down.
        }
Ejemplo n.º 2
0
        double _speed = 512; // pixels per second

        #endregion Fields

        #region Constructors

        public PlayerCharacter(TextureManager textureManager, BulletManager bulletManager)
        {
            _bulletManager = bulletManager;
            _bulletTexture = textureManager.Get("bullet");
            _sprite.Texture = textureManager.Get("player_spaceship");
            _sprite.SetScale(_scale, _scale);
            //_sprite.SetRotation(Math.PI / 2);
        }
Ejemplo n.º 3
0
 public Enemy(TextureManager textureManager, EffectsManager effectsManager, BulletManager bulletManager)
 {
     Health = 50;
     _sprite.Texture = textureManager.Get("enemy_ship");
     _sprite.SetScale(_scale, _scale);
     _sprite.SetRotation(Math.PI);
     _sprite.SetPosition(200, 0);
     _effectsManager = effectsManager;
     _bulletManager = bulletManager;
     _bulletTexture = textureManager.Get("bullet");
     MaxTimeToShoot = 12;
     MinTimeToShoot = 1;
     RestartShootCountDown();
 }
Ejemplo n.º 4
0
        public Enemy(TextureManager textureManager, EffectsManager effectsManager, BulletManager bulletManager, PlayerCharacter playerCharacter)
        {
            _playerCharacter = playerCharacter;
            _bulletManager = bulletManager;
            _bulletTexture = textureManager.Get("bullet");
            MaxTimeToShoot = 12;
            MinTimeToShoot = 1;
            RestartShootCountDown();

            _effectsManager = effectsManager;
            Health = 50; // default health value.
            _sprite.Texture = textureManager.Get("enemy_ship");
            _sprite.SetScale(_scale, _scale);
            _sprite.SetRotation(Math.PI); // make it face the player
            _sprite.SetPosition(200, 0); // put it somewhere easy to see
        }
Ejemplo n.º 5
0
        public EnemyManager(TextureManager textureManager, EffectsManager effectsManager, BulletManager bulletManager, PlayerCharacter playerCharacter, int leftBound)
        {
            _playerCharacter = playerCharacter;
            _bulletManager = bulletManager;
            _textureManager = textureManager;
            _effectsManager = effectsManager;
            _leftBound = leftBound;

            _upComingEnemies.Add(new EnemyDef("cannon_fodder", 30));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder", 29.5));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder", 29));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder", 28.5));

            _upComingEnemies.Add(new EnemyDef("cannon_fodder_low", 30));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_low", 29.5));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_low", 29));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_low", 28.5));

            _upComingEnemies.Add(new EnemyDef("cannon_fodder", 25));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder", 24.5));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder", 24));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder", 23.5));

            _upComingEnemies.Add(new EnemyDef("cannon_fodder_low", 20));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_low", 19.5));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_low", 19));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_low", 18.5));

            _upComingEnemies.Add(new EnemyDef("cannon_fodder_straight", 16));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_straight", 15.8));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_straight", 15.6));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_straight", 15.4));

            _upComingEnemies.Add(new EnemyDef("up_l", 10));
            _upComingEnemies.Add(new EnemyDef("down_l", 9));
            _upComingEnemies.Add(new EnemyDef("up_l", 8));
            _upComingEnemies.Add(new EnemyDef("down_l", 7));
            _upComingEnemies.Add(new EnemyDef("up_l", 6));

            // Sort enemies so the greater launch time appears first.
            _upComingEnemies.Sort(delegate(EnemyDef firstEnemy, EnemyDef secondEnemy)
            {
                return firstEnemy.LaunchTime.CompareTo(secondEnemy.LaunchTime);

            });
        }
Ejemplo n.º 6
0
        public Level(Input input, TextureManager textureManager, PersistantGameData gameData, SoundManager soundManager, PotatoEngine.Font generalFont)
        {
            _input          = input;
            _textureManager = textureManager;
            _soundManager   = soundManager;
            _gameData       = gameData;

            _background = new ScrollingBackground(_textureManager.Get("background"));
            _background.SetScale(2, 2);
            _background.Speed = 0.15f;

            _backgroundLayer = new ScrollingBackground(_textureManager.Get("background_layer_1"));
            _backgroundLayer.SetScale(2, 2);
            _backgroundLayer.Speed = 0.1f;

            _planet_28         = new Sprite();
            _planet_28.Texture = _textureManager.Get("planet_28");
            _planet_28.SetScale(0.5, 0.5);
            _planet_28.SetPosition(300, -300);

            _playArea        = new RectangleF(-1260 / 2, -750 / 2, 1260, 750);
            _bulletManager   = new BulletManager(_playArea);
            _effectsManager  = new EffectsManager(_textureManager);
            _playerCharacter = new PlayerCharacter(_textureManager, _effectsManager, _bulletManager, _playArea);

            if (_gameData.NewGame)
            {
                _playerCharacter.Lives = _startLives;
                _playerCharacter.Score = 0;
            }
            else
            {
                _playerCharacter.Lives = _gameData.Lives;
                _playerCharacter.Score = _gameData.Score;
            }

            _enemyManager = new EnemyManager(_textureManager, _effectsManager, _bulletManager, _playerCharacter, _playArea, _gameData.CurrentLevel.Enemies, -1300);

            Finished = false;
        }
Ejemplo n.º 7
0
        public EnemyManager(TextureManager textureManager, EffectsManager effectsManager, BulletManager bulletManager, PlayerCharacter playerCharacter, int leftBound)
        {
            _playerCharacter = playerCharacter;
            _bulletManager   = bulletManager;
            _textureManager  = textureManager;
            _effectsManager  = effectsManager;
            _leftBound       = leftBound;

            _upComingEnemies.Add(new EnemyDef("cannon_fodder", 30));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder", 29.5));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder", 29));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder", 28.5));

            _upComingEnemies.Add(new EnemyDef("cannon_fodder_low", 30));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_low", 29.5));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_low", 29));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_low", 28.5));

            _upComingEnemies.Add(new EnemyDef("cannon_fodder", 25));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder", 24.5));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder", 24));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder", 23.5));

            _upComingEnemies.Add(new EnemyDef("cannon_fodder_low", 20));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_low", 19.5));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_low", 19));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_low", 18.5));

            _upComingEnemies.Add(new EnemyDef("cannon_fodder_straight", 16));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_straight", 15.8));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_straight", 15.6));
            _upComingEnemies.Add(new EnemyDef("cannon_fodder_straight", 15.4));


            _upComingEnemies.Add(new EnemyDef("up_l", 10));
            _upComingEnemies.Add(new EnemyDef("down_l", 9));
            _upComingEnemies.Add(new EnemyDef("up_l", 8));
            _upComingEnemies.Add(new EnemyDef("down_l", 7));
            _upComingEnemies.Add(new EnemyDef("up_l", 6));



            // Sort enemies so the greater launch time appears first.
            _upComingEnemies.Sort(delegate(EnemyDef firstEnemy, EnemyDef secondEnemy)
            {
                return(firstEnemy.LaunchTime.CompareTo(secondEnemy.LaunchTime));
            });
        }
Ejemplo n.º 8
0
 public PlayerCharacter(TextureManager textureManager, EffectsManager effectsManager, BulletManager bulletManager, RectangleF playArea)
 {
     _sprite.Texture = textureManager.Get("player_ship");
     _sprite.SetScale(0.6, 0.6);
     _effectsManager = effectsManager;
     _bulletManager  = bulletManager;
     _bulletTexture  = textureManager.Get("bullet");
     _bounds         = playArea;
 }
Ejemplo n.º 9
0
        public EnemyManager(TextureManager textureManager, EffectsManager effectsManager, BulletManager bulletManager, PlayerCharacter playerCharacter, RectangleF playArea, List <EnemyDef> upComingEnemies, int leftBound)
        {
            _textureManager  = textureManager;
            _effectsManager  = effectsManager;
            _bulletManager   = bulletManager;
            _playerCharacter = playerCharacter;
            _leftBound       = leftBound;
            _bounds          = playArea;

            _upComingEnemies = upComingEnemies;

            _upComingEnemies.Sort(delegate(EnemyDef firstEnemy, EnemyDef secondEnemy)
            {
                return(firstEnemy.LaunchTime.CompareTo(secondEnemy.LaunchTime));
            });

            //Enemy enemy = new Enemy(_textureManager, _effectsManager);
            //_enemies.Add(enemy);
        }