CreatePowerup() public method

Factory method for spawning a projectile
public CreatePowerup ( PowerupType powerupType, Vector2 position ) : ScrollingShooter.Powerup
powerupType PowerupType
position Vector2 The position of the projectile in the game world
return ScrollingShooter.Powerup
Exemplo n.º 1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create our viewports
            gameViewport  = GraphicsDevice.Viewport;
            worldViewport = new Viewport(0, 0, 768, 720);   // Twice as wide as 16 tiles
            guiViewport   = new Viewport(768, 0, 512, 720); // Remaining space

            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            GameObjectManager = new GameObjectManager(Content);

            // TODO: use this.Content to load your game content here
            Player = GameObjectManager.CreatePlayerShip(PlayerShipType.Shrike, new Vector2(300, 300));
            GameObjectManager.CreatePowerup(PowerupType.Fireball, new Vector2(100, 200));

            LevelManager.LoadContent();
            LevelManager.LoadLevel("LavaLevel2");
            GuiManager.LoadContent();
            GameState = GameState.Initializing;
        }
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create our viewports
            gameViewport = GraphicsDevice.Viewport;
            worldViewport = new Viewport(0, 0, 768, 720); // Twice as wide as 16 tiles
            guiViewport = new Viewport(768, 0, 512, 720); // Remaining space

            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            GameObjectManager = new GameObjectManager(Content);

            // TODO: use this.Content to load your game content here
            Player = GameObjectManager.CreatePlayerShip(PlayerShipType.Shrike, new Vector2(300, 300));
            GameObjectManager.CreatePowerup(PowerupType.Fireball, new Vector2(100, 200));
            //Player.ApplyPowerup(PowerupType.Fireball);

            LevelManager.LoadContent();
            LevelManager.LoadLevel("crystalland");
            GuiManager.LoadContent();
            GameState = GameState.Initializing;
        }
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            GameObjectManager = new GameObjectManager(Content);

            // TODO: use this.Content to load your game content here
            player = GameObjectManager.CreatePlayerShip(PlayerShipType.Shrike, new Vector2(300, 300));
            GameObjectManager.CreatePowerup(PowerupType.Fireball, new Vector2(100, 200));
            //player.ApplyPowerup(PowerupType.Fireball);

            tilemap = Content.Load<Tilemap>("Tilemaps/example");
            for (int i = 0; i < tilemap.GameObjectGroupCount; i++)
            {
                for (int j = 0; j < tilemap.GameObjectGroups[i].GameObjectData.Count(); j++ )
                {
                    GameObjectData goData = tilemap.GameObjectGroups[i].GameObjectData[j];
                    Vector2 position = new Vector2(goData.Position.Center.X, goData.Position.Center.Y);
                    GameObject go;

                    switch (goData.Category)
                    {
                        case "Powerup":
                            go = GameObjectManager.CreatePowerup((PowerupType)Enum.Parse(typeof(PowerupType), goData.Type), position);
                            goData.ID = go.ID;
                            break;

                        case "Enemy":
                            go = GameObjectManager.CreateEnemy((EnemyType)Enum.Parse(typeof(EnemyType), goData.Type), position);
                            goData.ID = go.ID;
                            break;
                    }
                }
            }
            tilemap.Scrolling = true;

            GameObjectManager.CreateEnemy(EnemyType.Cobalt, new Vector2(200, 200));
        }