Beispiel #1
0
        /// <summary>
        /// Loads the textures and animations for the enemy
        /// </summary>
        /// <param name="content"></param>
        /// <param name="step"></param>
        public void LoadContent(ContentManager content, int step)
        {
            Texture2D trexTexture =
                content.Load<Texture2D>("textures/mainTrexGray");

            Color[,] colorArray = TextureTo2DArray(trexTexture);

            List<Texture2D> textures = new List<Texture2D>();
            if(step == 0)
            {
                textures.Add(content.Load<Texture2D>("textures/mainTrexGray1"));
                textures.Add(content.Load<Texture2D>("textures/mainTrexGray1"));
            }
            textures.Add(content.Load<Texture2D>("textures/mainTrexGray2"));
            textures.Add(content.Load<Texture2D>("textures/mainTrexGray0"));
            textures.Add(content.Load<Texture2D>("textures/mainTrexGray3"));
            textures.Add(content.Load<Texture2D>("textures/mainTrexGray0"));
            textures.Add(content.Load<Texture2D>("textures/mainTrexGray2"));
            textures.Add(content.Load<Texture2D>("textures/mainTrexGray0"));
            textures.Add(content.Load<Texture2D>("textures/mainTrexGray3"));

            // Texture and scale the dinosaur
            Animation = new Animator(textures);
            Animation.advance(step * 3);
            Texture = Animation.next();
            TextureArray = colorArray;

            CreateBoundingBox();

            roarSound =
                content.Load<SoundEffect>("sounds/mainTrexRoar").CreateInstance();

            roarSound.Volume = 1.0f;
            roarSound.IsLooped = false;
        }
Beispiel #2
0
        /// <summary>
        /// Loads the textures for the player and its animations
        /// </summary>
        /// <param name="content"></param>
        public void LoadContent(ContentManager content)
        {
            Texture2D dinosaur1Texture =
                content.Load<Texture2D>("textures/mainDinoPurple");

            Texture2D dinosaur2Texture =
                content.Load<Texture2D>("textures/mainDinoPurple");

            // Special texture arrays for collision detection
            Color[,] colorArray =
                TextureTo2DArray(dinosaur1Texture);

            List<Texture2D> textures = new List<Texture2D>();
            textures.Add(content.Load<Texture2D>("textures/mainDinoPurple0"));
            textures.Add(content.Load<Texture2D>("textures/mainDinoPurple1"));
            textures.Add(content.Load<Texture2D>("textures/mainDinoPurple0"));
            textures.Add(content.Load<Texture2D>("textures/mainDinoPurple2"));

            // Texture and scale the dinosaur
            Animation = new Animator(textures);
            Texture = Animation.next();
            TextureArray = colorArray;

            CreateBoundingBox();

            life.LoadContent(content);
        }
Beispiel #3
0
        /// <summary>
        /// Load the texture associated with the plant and its animation.
        /// If the plant has a flower, load that texture too.
        /// </summary>
        /// <param name="content"></param>
        public void LoadContent(ContentManager content)
        {
            // Texture and scale the plant
            Texture2D plantTexture =
                content.Load<Texture2D>("textures/mainPlant");

            Color[,] colorArray =
                base.TextureTo2DArray(plantTexture);

            List<Texture2D> textures = new List<Texture2D>();
            //textures.Add(content.Load<Texture2D>("textures/mainPlant0"));
            textures.Add(content.Load<Texture2D>("textures/mainPlant0"));
            textures.Add(content.Load<Texture2D>("textures/mainPlant1"));
            textures.Add(content.Load<Texture2D>("textures/mainPlant2"));
            textures.Add(content.Load<Texture2D>("textures/mainPlant3"));
            textures.Add(content.Load<Texture2D>("textures/mainPlant4"));
            textures.Add(content.Load<Texture2D>("textures/mainPlant5"));
            textures.Add(content.Load<Texture2D>("textures/mainPlant6"));
            textures.Add(content.Load<Texture2D>("textures/mainPlant6"));

            Animation = new Animator(textures);
            Texture = Animation.next();
            TextureArray = colorArray;

            CreateBoundingBox();

            flowerTexture =
                content.Load<Texture2D>("textures/mainFlowerYellow");

            eatSound =
                content.Load<SoundEffect>("sounds/mainEating").CreateInstance();
            eatSound.Volume = 1.0f;
            eatSound.IsLooped = false;
        }