Exemple #1
0
        public void Load(ContentManager content)
        {
            AnimatedTexture animation = new AnimatedTexture(Vector2.Zero, 0, 1, 1);

            animation.Load(content, "Bronze-Loot-Pile", 1, 5);

            sprite.Add(animation, 0, 0);
        }
        public void Load(ContentManager content)
        {
            AnimatedTexture animation = new AnimatedTexture(Vector2.Zero, 0, 1, 1);

            animation.Load(content, "Healthpack", 1, 5);

            sprite.Add(animation, 0, 0);
        }
        public void Load(ContentManager content)
        {
            AnimatedTexture animation = new AnimatedTexture(Vector2.Zero, 0, 1, 1);

            animation.Load(content, "zombie", 4, 5);

            sprite.Add(animation, 16, 0);
        }
        public void Load(ContentManager content)
        {
            AnimatedTexture animation = new AnimatedTexture(Vector2.Zero, 0, 1, 1);

            animation.Load(content, "walk", 12, 20);

            jumpSound         = content.Load <SoundEffect>("Jump(edited)");
            jumpSoundInstance = jumpSound.CreateInstance();

            sprite.Add(animation, 0, -5);
            sprite.Pause();
        }
Exemple #5
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 a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here

            AIE.StateManager.CreateState("SPLASH", new SplashState());
            AIE.StateManager.CreateState("GAME", new GameState());
            AIE.StateManager.CreateState("GAMEOVER", new GameOverState());

            AIE.StateManager.PushState("SPLASH");

            player.Load(Content);

            agency_FB = Content.Load <SpriteFont>("Agency_FB");
            heart     = Content.Load <Texture2D>("Heart");
            //healthPack = Content.Load<Texture2D>("Healthpack");
            //bronzeLoot = Content.Load<Texture2D>("Bronze-Loot-Pile");
            //silverLoot = Content.Load<Texture2D>("Silver-Loot-Pile");
            //goldLoot = Content.Load<Texture2D>("Gold-Loot-Pile");

            zombieDeathSound         = Content.Load <SoundEffect>("ZombieDeath");
            zombieDeathSoundInstance = zombieDeathSound.CreateInstance();

            var viewportAdaptor = new BoxingViewportAdapter(Window, GraphicsDevice, ScreenWidth, ScreenHeight);

            camera = new Camera2D(viewportAdaptor);

            camera.Position = player.Position - new Vector2(ScreenWidth / 2, ScreenHeight / 2);

            backgound = Content.Load <TiledMap>("Level3-background");
            map       = Content.Load <TiledMap>("Level3");
            foreach (TiledTileLayer layer in map.TileLayers)
            {
                if (layer.Name == "Collisions")
                {
                    collisionLayer = layer;
                }
            }

            foreach (TiledObjectGroup group in map.ObjectGroups)
            {
                if (group.Name == "Enemies")
                {
                    foreach (TiledObject obj in group.Objects)
                    {
                        Enemy enemy = new Enemy(this);
                        enemy.Load(Content);
                        enemy.Position = new Vector2(obj.X, obj.Y);
                        enemies.Add(enemy);
                    }
                }

                else if (group.Name == "Bronze")
                {
                    foreach (TiledObject obj in group.Objects)
                    {
                        BronzeLootPile bronzeLootPile = new BronzeLootPile(this);
                        bronzeLootPile.Load(Content);
                        bronzeLootPile.Position = new Vector2(obj.X, obj.Y);
                        bronzeLootPiles.Add(bronzeLootPile);
                    }
                }

                else if (group.Name == "Silver")
                {
                    foreach (TiledObject obj in group.Objects)
                    {
                        SilverLootPile silverLootPile = new SilverLootPile(this);
                        silverLootPile.Load(Content);
                        silverLootPile.Position = new Vector2(obj.X, obj.Y);
                        silverLootPiles.Add(silverLootPile);
                    }
                }

                else if (group.Name == "Gold")
                {
                    foreach (TiledObject obj in group.Objects)
                    {
                        GoldLootPile goldLootPile = new GoldLootPile(this);
                        goldLootPile.Load(Content);
                        goldLootPile.Position = new Vector2(obj.X, obj.Y);
                        goldLootPiles.Add(goldLootPile);
                    }
                }

                else if (group.Name == "Healthpacks")
                {
                    foreach (TiledObject obj in group.Objects)
                    {
                        HealthPack healthPack = new HealthPack(this);
                        healthPack.Load(Content);
                        healthPack.Position = new Vector2(obj.X, obj.Y);
                        healthPacks.Add(healthPack);
                    }
                }

                else if (group.Name == "Goal")
                {
                    TiledObject obj = group.Objects[0];
                    if (obj != null)
                    {
                        AnimatedTexture anim = new AnimatedTexture(Vector2.Zero, 0, 1, 1);
                        anim.Load(Content, "chest", 1, 1);
                        goal = new Sprite();
                        goal.Add(anim, 0, 5);
                        goal.position = new Vector2(obj.X, obj.Y);
                    }
                }

                else if (group.Name == "PlayerSpawn")
                {
                    TiledObject obj = group.Objects[0];
                    if (obj != null)
                    {
                        player.Position = new Vector2(obj.X, obj.Y);
                    }
                }
            }

            // load the game music
            gameMusic = Content.Load <Song>("SuperHero_original(edited)");
            MediaPlayer.Play(gameMusic);
        }