Example #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 a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            //***********************************LOADING MENUS***************************************//
            intro.loadContent(Content);
            timex.loadContent(Content);
            instruct.loadContent(Content);
            instruct2.loadContent(Content);
            gameover.loadContent(Content);
            //***************************************************************************************//

            game_engine.LoadContent(Content);
        }
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        public void LoadContent(ContentManager Content)
        {
            // Create a new SpriteBatch, which can be used to draw textures.

            Texture2D textureb = Content.Load <Texture2D>("background_cropped"); // background
            Texture2D texturef = Content.Load <Texture2D>("foreground_cropped"); // foreground
            Texture2D textureo = Content.Load <Texture2D>("objects1");           // objects

            tiles = new List <Texture2D>();                                      // tiles
            tiles.Add(textureb);
            tiles.Add(texturef);
            tiles.Add(textureo); // add bg, fg, obj's to draw
            game_state.tile_engine = new TileEngine(32, tiles);

            //Character Sprite
            character_sprite[(int)weaponType.NONE].Load(Content, "player_no", 32, 36, 200);
            character_sprite[(int)weaponType.SWORD].Load(Content, "player_sword", 32, 36, 200);
            character_sprite[(int)weaponType.LASER].Load(Content, "player_gun", 32, 36, 200);

            monster_texture[(int)enemyType.GRUNT] = Content.Load <Texture2D>("grunt");

            monster_texture[(int)enemyType.BEETLE]    = Content.Load <Texture2D>("beetles");
            monster_texture[(int)enemyType.BERSERKER] = Content.Load <Texture2D>("berserker");
            monster_texture[(int)enemyType.TROOPER]   = Content.Load <Texture2D>("trooper");

            LoadLevel(0);
            bullet_sprite.Load(Content, "bullet", 9, 9, 0);
            sword_sprite.Load(Content, "player_sword_attack", 32, 36, 0);


            for (int i = 0; i < game_state.monster_engine.GetMonsters().Count(); ++i) // draw new monsters randomly
            {
                Enemy  new_enemy      = game_state.monster_engine.GetMonsters().ElementAt(i);
                Sprite enemy_sprite   = new Sprite();
                int    new_enemy_type = (int)new_enemy.getType();

                enemy_sprite.Load(monster_texture[new_enemy_type], new_enemy.getWidth(), new_enemy.getHeight(), 200);
                new_enemy.setSprite(enemy_sprite);
            }

            game_state.bullet_engine = new BulletEngine(game_state);


            uparrow         = Content.Load <Texture2D>("arrowup");
            downarrow       = Content.Load <Texture2D>("arrowdown");
            leftarrow       = Content.Load <Texture2D>("arrowleft");
            rightarrow      = Content.Load <Texture2D>("arrowright");      // components for "keypad" HUD
            fire_button     = Content.Load <Texture2D>("fire");            // "fire" button (attacks enemies when pushed)
            item_background = Content.Load <Texture2D>("item_background"); // user taps this to bring up inventory

            game_state.fx_engine.LoadSound(Content, "shoot", soundType.SHOOT);

            game_state.fx_engine.LoadSound(Content, "enemy_hit", soundType.ENEMY_HURT);
            game_state.fx_engine.LoadSound(Content, "enemy_die", soundType.ENEMY_DIE);
            game_state.fx_engine.LoadSound(Content, "player_hurt", soundType.PLAYER_HURT);
            game_state.fx_engine.LoadSound(Content, "player_sword_s", soundType.SWORD);
            game_state.fx_engine.LoadSound(Content, "item_pickup", soundType.ITEM_PICKUP);
            game_state.fx_engine.LoadExplosion(Content, "expl", explosionType.SMALL);
            //SoundEffect game_music = Content.Load<SoundEffect>("01AttackPanda1");
            Song game_music = Content.Load <Song>("01AttackPanda1");

            MediaPlayer.Play(game_music);
            MediaPlayer.IsRepeating = true;

            //********************************LOADING GRAPHIC SPRITES********************************//
            backpack             = Content.Load <Texture2D>("backpack");       // loading backpack
            healthbar_empty      = Content.Load <Texture2D>("healthbar");      // load health bar
            healthbar_full       = Content.Load <Texture2D>("healthbar_full"); // load health bar
            health_bar_rec       = new Rectangle((int)healthpos.X, (int)healthpos.Y, health_bar_width, 30);
            health_bar_empty_rec = new Rectangle((int)healthpos.X, (int)healthpos.Y, health_bar_width, 30);
            //**************************************************************************************//


            //********************MISCELLANEOUS*****************************************************//
            displayFont = Content.Load <SpriteFont>("StatsFont");   //load a font from a formatted file
            //displayFont = Content.Load<SpriteFont>("Courier New");
            itemfont    = Content.Load <SpriteFont>("ItemFont");    // ^^
            expiredfont = Content.Load <SpriteFont>("TimeExpired"); // ^^
            //***************************************************************************************//

            backpackmenu.loadContent(Content);
            gameOver.loadContent(Content);
            timex.loadContent(Content);
            //load content for each respective menu
        }
Example #3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        public void LoadContent(ContentManager Content)
        {
            // Create a new SpriteBatch, which can be used to draw textures.

            Texture2D textureb = Content.Load <Texture2D>("background_cropped");
            Texture2D texturef = Content.Load <Texture2D>("foreground_cropped");
            Texture2D textureo = Content.Load <Texture2D>("objects1");

            tiles = new List <Texture2D>();
            tiles.Add(textureb);
            tiles.Add(texturef);
            tiles.Add(textureo);
            game_state.tile_engine = new TileEngine(32, tiles);

            //back_layer = tileEngine.getLayer(LayerType.BACKGROUND);
            //Character Sprite
            character_sprite[(int)weaponType.NONE].Load(Content, "player_no", 32, 36, 200);
            character_sprite[(int)weaponType.SWORD].Load(Content, "player_sword", 32, 36, 200);
            character_sprite[(int)weaponType.LASER].Load(Content, "player_gun", 32, 36, 200);
            //character_sprite.loc.X = 400;
            //character_sprite.loc.Y = 240;

            monster_texture[(int)enemyType.GRUNT] = Content.Load <Texture2D>("grunt");

            monster_texture[(int)enemyType.BEETLE]    = Content.Load <Texture2D>("beetles");
            monster_texture[(int)enemyType.BERSERKER] = Content.Load <Texture2D>("berserker");
            monster_texture[(int)enemyType.TROOPER]   = Content.Load <Texture2D>("trooper");
            //monster_sprites[(int)enemyType.GRUNT].Load(monster_texture[(int)enemyType.GRUNT], 32, 48);
            //monster_sprites[(int)enemyType.GRUNT].StartAnimating((int)PlayerDir.UP * 3, ((int)PlayerDir.UP * 3) + 2);
            LoadLevel(0);
            bullet_sprite.Load(Content, "bullet", 9, 9, 0);
            sword_sprite.Load(Content, "player_sword_attack", 32, 36, 0);


            //game_state.monster_engine.AddMonster(new Enemy(500, 240, 48, 54, enemyType.GRUNT));
            //game_state.monster_engine.AddMonster(new Enemy(300, 400, 48, 54, enemyType.GRUNT));
            for (int i = 0; i < game_state.monster_engine.GetMonsters().Count(); ++i)
            {
                Enemy  new_enemy      = game_state.monster_engine.GetMonsters().ElementAt(i);
                Sprite enemy_sprite   = new Sprite();
                int    new_enemy_type = (int)new_enemy.getType();

                enemy_sprite.Load(monster_texture[new_enemy_type], new_enemy.getWidth(), new_enemy.getHeight(), 200);
                new_enemy.setSprite(enemy_sprite);
                //game_state.monster_engine.AddMonster(new_enemy);
            }

            game_state.bullet_engine = new BulletEngine(game_state);
            //character_sprite.StartAnimating(6, 8);
            // TODO: use this.Content to load your game content here

            uparrow         = Content.Load <Texture2D>("arrowup");
            downarrow       = Content.Load <Texture2D>("arrowdown");
            leftarrow       = Content.Load <Texture2D>("arrowleft");
            rightarrow      = Content.Load <Texture2D>("arrowright"); // components for "keypad" HUD
            fire_button     = Content.Load <Texture2D>("fire");
            item_background = Content.Load <Texture2D>("item_background");

            game_state.fx_engine.LoadSound(Content, "shoot", soundType.SHOOT);
            game_state.fx_engine.LoadSound(Content, "hurt", soundType.HURT);
            game_state.fx_engine.LoadSound(Content, "sword_swing", soundType.SWORD);
            game_state.fx_engine.LoadExplosion(Content, "expl", explosionType.SMALL);
            //SoundEffect game_music = Content.Load<SoundEffect>("01AttackPanda1");
            Song game_music = Content.Load <Song>("01AttackPanda1");

            MediaPlayer.Play(game_music);
            //game_music.Play();

            //********************************LOADING GRAPHIC SPRITES********************************//
            backpack             = Content.Load <Texture2D>("backpack");       // loading backpack
            healthbar_empty      = Content.Load <Texture2D>("healthbar");      // load health bar
            healthbar_full       = Content.Load <Texture2D>("healthbar_full"); // load health bar
            health_bar_rec       = new Rectangle((int)healthpos.X, (int)healthpos.Y, health_bar_width, 30);
            health_bar_empty_rec = new Rectangle((int)healthpos.X, (int)healthpos.Y, health_bar_width, 30);
            //**************************************************************************************//


            //********************MISCELLANEOUS*****************************************************//
            displayFont = Content.Load <SpriteFont>("StatsFont");   //load a font from a formatted file
            //displayFont = Content.Load<SpriteFont>("Courier New");
            itemfont    = Content.Load <SpriteFont>("ItemFont");    // ^^
            expiredfont = Content.Load <SpriteFont>("TimeExpired"); // ^^
            //***************************************************************************************//

            backpackmenu.loadContent(Content);
            gameOver.loadContent(Content);
            timex.loadContent(Content);
        }