예제 #1
0
        public void InitializeGameState()
        {
            stateMachine = new StateMachine();
            player       = new Player(this,
                                      shape: new DynamicShape(new Vec2F(0.45f, 0.1f), new Vec2F(0.1f, 0.1f)),
                                      image: new Image(Path.Combine("Assets", "Images", "Player.png")));

            GalagaBus.GetBus().InitializeEventBus(new List <GameEventType>()
            {
                GameEventType.PlayerEvent
            });

            GalagaBus.GetBus().Subscribe(GameEventType.PlayerEvent, player);

            enemyStrides =
                ImageStride.CreateStrides(4, Path.Combine("Assets", "Images", "BlueMonster.png"));
            enemies = new EntityContainer <Enemy>();

            PlayerShot  = new Image(Path.Combine("Assets", "Images", "BlueMonster.png"));
            playerShots = new EntityContainer <PlayerShot>();

            explosionStrides = ImageStride.CreateStrides(8,
                                                         Path.Combine("Assets", "Images", "Explosion.png"));
            explosions = new AnimationContainer(40);

            score = new Score(new Vec2F(0.43f, -0.12f), new Vec2F(0.2f, 0.2f));

            v_Formation = new V_Formation();
            v_Formation.CreateEnemies(enemyStrides);
            enemies = v_Formation.Enemies;

            down       = new Down();
            zigzagdown = new ZigZagDown();
            noMove     = new NoMove();
        }
예제 #2
0
        public GameRunning()
        {
            isGameOver = false;

            player = new Player(new DynamicShape(new Vec2F(0.45f, 0.1f), new Vec2F(0.1f, 0.1f)),
                                new Image(Path.Combine("Assets", "Images", "Player.png")));
            score        = new Score(new Vec2F(0.02f, 0.7f), new Vec2F(0.3f, 0.3f));
            enemyStrides = ImageStride.CreateStrides(4,
                                                     Path.Combine("Assets", "Images", "BlueMonster.png"));
            squiggleSquadron = new SquiggleSquadron(6);
            AddEnemies();

            noMove     = new NoMove();
            down       = new Down();
            zigZagDown = new ZigZagDown();

            playerShots = new List <PlayerShot>();
            // Preloads the bullet image
            bullet           = new Image(Path.Combine("Assets", "Images", "BulletRed2.png"));
            explosionStrides = ImageStride.CreateStrides(8, Path.Combine("Assets", "Images", "Explosion.png"));
            // Here the constructor is given the argument 6 since that is the total amount of enemies.
            explosions = new AnimationContainer(6);
            //backGroundImage = new Entity(new StationaryShape(new Vec2F(0.2f, 0.2f), new Vec2F(0.5f, 0.5f)), new Image("Assets/Images/TitleImage.png"));
            GalagaBus.GetBus().Subscribe(GameEventType.MovementEvent, player);
        }
예제 #3
0
        public GameRunning()
        {
            backgroundImage = new Image(Path.Combine("Assets", "Images", "SpaceBackground.png"));
            player          = new Player(new Vec2F(0.45f, 0.1f), new Vec2F(0.1f, 0.1f));

            enemeySquadrons = new List <ISquadron>()
            {
                new BlueSquadron(),
                new GreenSquadron(),
                new RedSquadron()
            };
            greenEnemy = ImageStride.CreateStrides(2,
                                                   Path.Combine("Assets", "Images", "GreenMonster.png"));
            blueEnemy = ImageStride.CreateStrides(4,
                                                  Path.Combine("Assets", "Images", "BlueMonster.png"));
            redEnemy = ImageStride.CreateStrides(2,
                                                 Path.Combine("Assets", "Images", "RedMonster.png"));
            enemyTypes = new List <List <Image> >()
            {
                blueEnemy, greenEnemy, redEnemy
            };
            zigZagDown       = new ZigZagDown();
            explosionStrides = ImageStride.CreateStrides(8,
                                                         Path.Combine("Assets", "Images", "Explosion.png"));
            explosions  = new AnimationContainer(80);
            projectiles = new EntityContainer();
            laserImage  = new Image(Path.Combine("Assets", "Images", "BulletRed2.png"));

            for (int i = 0; i < enemeySquadrons.Count; i++)
            {
                enemeySquadrons[i].CreateEnemies(enemyTypes[i]);
            }
        }
예제 #4
0
        private void EnemyMove()
        {
            switch (movementSeed)
            {
            case 1:
                ZigZagDown zigZagDown = new ZigZagDown(this, speedMultiplier);
                zigZagDown.MoveEnemies(enemies);
                break;

            case 2:
                Down down = new Down(this, speedMultiplier);
                down.MoveEnemies(enemies);
                break;

            case 3:
                break;
            }
        }
예제 #5
0
        public void InitializeGameState()
        {
            backGroundImage = new Entity(
                new StationaryShape(new Vec2F(0, 0), new Vec2F(1, 1)),
                new Image(Path.Combine("Assets", "Images", "SpaceBackground.png")));
            player = new Player(
                new DynamicShape(new Vec2F(0.45f, 0.1f), new Vec2F(0.1f, 0.1f)),
                new Image(Path.Combine("Assets", "Images", "Player.png")));
            enemyStrides = ImageStride.CreateStrides(4,
                                                     Path.Combine("Assets", "Images", "BlueMonster.png"));
            enemies          = new List <Enemy>();
            row              = new Row();
            movementStrategy = new ZigZagDown();

            explosionStrides = ImageStride.CreateStrides(8,
                                                         Path.Combine("Assets", "Images", "Explosion.png"));
            explosions = new AnimationContainer(4);
            score      = new Score(new Vec2F(0.01f, -0.25f), new Vec2F(0.3f, 0.3f));


            row.CreateEnemies(enemyStrides);
        }