コード例 #1
0
        public Ship(Vector2f position, GameInterface gInterface, float speed)
        {
            isDead        = false;
            shipSpeed     = speed;
            isShielded    = false;
            gameInterface = gInterface;
            Position      = position;
            coolDown      = new TimeSpan(0, 0, 0, 0, 500);
            cd            = new Stopwatch();
            cd.Start();
            rectShape             = new RectangleShape(new SFML.System.Vector2f(SHIP_SIZE, SHIP_SIZE));
            rectShape.Texture     = Content.shipTex;
            rectShape.TextureRect = new IntRect(0, 0, SHIP_SIZE, SHIP_SIZE);
            rectShape.Scale       = new Vector2f(SIZE_FACTOR, SIZE_FACTOR);

            shieldShape             = new RectangleShape(new SFML.System.Vector2f(SHIELD_SIZE, SHIELD_SIZE));
            shieldShape.Texture     = Content.ShipShieldTex;
            shieldShape.TextureRect = new IntRect(0, 0, SHIELD_SIZE, SHIELD_SIZE);
            shieldShape.Scale       = new Vector2f(1.25f, 1.25f);
        }
コード例 #2
0
ファイル: Game.cs プロジェクト: DenKUD/ScrollShooter
        //Level[] levels;
        //Level cLevel;


        public Game()
        {
            gameInterface = new GameInterface();
            playerShip    = new Ship(new SFML.System.Vector2f(700, 500), gameInterface, 14f);
            enemies       = new LinkedList <Enemy>();
            enemies.AddLast(new Enemy(new SFML.System.Vector2f(300, 300), gameInterface, 14f));
            enemies.AddLast(new Enemy(new SFML.System.Vector2f(900, 300), gameInterface, 14f));
            wave1 = new Wave(enemies);
            //waves = new LinkedList<Wave>();
            //waves.AddLast(cWave);
            //var wave2 = new Wave(enemies);
            //waves.AddLast(wave2);
            //var level = new Level(waves);
            //levels = ;
            //levels.AddLast(level);
            var enemies2 = new LinkedList <Enemy>();

            enemies2.AddLast(new Enemy(new SFML.System.Vector2f(300, 300), gameInterface, 14f));
            enemies2.AddLast(new Enemy(new SFML.System.Vector2f(700, 300), gameInterface, 14f));
            enemies2.AddLast(new Enemy(new SFML.System.Vector2f(1000, 300), gameInterface, 14f));
            wave2 = new Wave(enemies2);
            var enemies3 = new LinkedList <Enemy>();

            enemies3.AddLast(new Enemy(new SFML.System.Vector2f(600, 300), gameInterface, 14f, true));
            wave3         = new Wave(enemies3);
            playTime      = new Stopwatch();
            playerBullets = new LinkedList <Bullet>();
            enemyBullets  = new LinkedList <Bullet>();
            playTime.Start();
            bonuses = new LinkedList <Bonus>();
            bonuses.AddLast(new Bonus(BonusType.SHIELD));
            //cLevel = levels.Last();
            // levels.RemoveLast();
            //waves = cLevel.waves;
            // cWave = waves.Last.Value;
            //waves.RemoveLast();
            currentWave = 1;
            cWave       = wave1;
        }