Exemple #1
0
        /// <summary>
        /// Loads a particular enemy sprite sheet and sounds.
        /// </summary>
        public new void LoadContent(string spriteSet)
        {
            // Load animations.
            spriteSet = "Sprites/" + spriteSet + "/";
            runAnimation = new Animation(Level.Content.Load<Texture2D>(spriteSet + "Run"), 0.15f, true);
            idleAnimation = new Animation(Level.Content.Load<Texture2D>(spriteSet + "Idle"), 0.15f, true);
            smallRunAnimation = new Animation(Level.Content.Load<Texture2D>(spriteSet + "SmallRun"), 0.15f, true);
            smallIdleAnimation = new Animation(Level.Content.Load<Texture2D>(spriteSet + "SmallIdle"), 0.15f, true);

            sprite.PlayAnimation(idleAnimation);

            dieSound = Level.Content.Load<SoundEffect>("Sounds/TuberculosisDeath");

            // Calculate bounds within texture size.
            int width = (int)(idleAnimation.FrameWidth * 0.9);
            int left = (idleAnimation.FrameWidth - width) / 2;
            int height = (int)(idleAnimation.FrameWidth);
            int top = idleAnimation.FrameHeight - height;
            localBounds = new Rectangle(left, top, width, height);

            //mini TB bounds
            int swidth = (int)(smallIdleAnimation.FrameWidth * 0.9);
            int sleft = (smallIdleAnimation.FrameWidth - swidth) / 2;
            int sheight = (int)(smallIdleAnimation.FrameWidth);
            int stop = smallIdleAnimation.FrameHeight - sheight;
            smallBounds = new Rectangle(sleft, stop, swidth, sheight);
        }
Exemple #2
0
        public void Update(GameTime gameTime)
        {
            float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;

            float x = (float)level.Player.rightStickX;
            float y = (float)level.Player.rightStickY;

            angle = (float)Math.Atan2(y, x);
            animation = new Animation(level.Content.Load<Texture2D>(String.Format("Sprites/vaccine/Level{0}/vaccine{1}", Session.StatisticsManager.LevelIndex, level.Player.shotIndex)), 0.1f, true);

            float mag = (float)Math.Sqrt(x * x + y * y);
            invisible =  (mag == 0);

            if (invisible) return;

            Vector2 delta = new Vector2(60*x/mag + 10, 60*y/mag - 60);
            position = level.Player.Position + delta;
        }
Exemple #3
0
        /// <summary>
        /// Loads a particular enemy sprite sheet and sounds.
        /// </summary>
        public new void LoadContent(string spriteSet)
        {
            // Load animations.
            spriteSet = "Sprites/" + spriteSet + "/";
            runAnimation = new Animation(Level.Content.Load<Texture2D>(spriteSet + "Run"), 0.1f, true);
            idleAnimation = new Animation(Level.Content.Load<Texture2D>(spriteSet + "Idle"), 0.15f, true);
            deathAnimation = new Animation(Level.Content.Load<Texture2D>(spriteSet + "Die"), 0.15f, false);

            sprite.PlayAnimation(idleAnimation);

            dieSound = Level.Content.Load<SoundEffect>("Sounds/HIVDeath");

            // Calculate bounds within texture size.
            int width = (int)(idleAnimation.FrameWidth * 0.80);
            int left = (idleAnimation.FrameWidth - width) / 2;
            int height = (int)(idleAnimation.FrameWidth * 0.55);
            int top = idleAnimation.FrameHeight - height;
            localBounds = new Rectangle(left, top, width, height);
        }
Exemple #4
0
        /// <summary>
        /// Loads a particular enemy sprite sheet and sounds.
        /// </summary>
        public new void LoadContent(string spriteSet)
        {
            // Load animations.
            spriteSet = "Sprites/" + spriteSet + "/";
            runAnimation = idleAnimation = new Animation(Level.Content.Load<Texture2D>(spriteSet + "Run"), 0.15f, true);
            deathAnimation = new Animation(Level.Content.Load<Texture2D>(spriteSet + "Die"), 0.15f, false);

            //NEED TO HAVE THIS, or else origin won't be set
            sprite.PlayAnimation(idleAnimation);

            dieSound = Level.Content.Load<SoundEffect>("Sounds/TuberculosisDeath"); //same for now

            // Calculate bounds within texture size.
            int width = (int)(runAnimation.FrameWidth * .95);
            int left = (int)((runAnimation.FrameWidth - width)*0.55);
            int height = (int)(runAnimation.FrameWidth);
            int top = runAnimation.FrameHeight - height;
            localBounds = new Rectangle(left, top, width, height);
        }
Exemple #5
0
 public void LoadContent()
 {
     // Load animations
     animation = new Animation(level.Content.Load<Texture2D>(String.Format("Sprites/vaccine/Level{0}/vaccine{1}", Session.StatisticsManager.LevelIndex, level.Player.shotIndex)), 0.1f, true);
 }
Exemple #6
0
 public void LoadContent(string spriteSet)
 {
     // Load animations
     spriteSet = "Sprites/" + spriteSet + "/";
     animation = new Animation(level.Content.Load<Texture2D>(spriteSet + "GoldDot"), 0.5f, false);
 }
Exemple #7
0
        public void LoadContent()
        {
            texture = Level.Content.Load<Texture2D>("Sprites/HIV/HIVShot");

            shotAnimation = new Animation(texture, 0.1f, false);
            sprite.PlayAnimation(shotAnimation);

            origin = new Vector2(texture.Width / 2.0f, texture.Height / 2.0f);
            shotSound = Level.Content.Load<SoundEffect>("Sounds/SlingshotFire");
            //should maybe change the sound...

            // Calculate bounds within texture size.
            int width = (int)(shotAnimation.FrameWidth);
            int left = 0;
            int height = (int)(shotAnimation.FrameWidth);
            int top = 0;
            localBounds = new Rectangle(left, top, width, height);
        }
Exemple #8
0
        public void LoadContent()
        {
            texture = Level.Content.Load<Texture2D>(String.Format("Sprites/vaccine/Level{0}/vaccine{1}", Session.StatisticsManager.LevelIndex, shotIndex));

            shotAnimation = new Animation(texture, 0.1f, false);
            sprite.PlayAnimation(shotAnimation);

            origin = new Vector2(texture.Width / 2.0f, texture.Height / 2.0f);
            shotSound = Level.Content.Load<SoundEffect>("Sounds/SlingshotFire");

            // Calculate bounds within texture size.
            int width = (int)(shotAnimation.FrameWidth *.5);
            width = (int)MathHelper.Clamp(width, 7, 32);

            int left = (shotAnimation.FrameWidth - width) / 2;
            int height = (int)(shotAnimation.FrameHeight *.16);
            height = (int)MathHelper.Clamp(height, 7, 32);

            int top = (shotAnimation.FrameHeight - height) / 2;
            localBounds = new Rectangle(left, top, width, height);
        }
Exemple #9
0
        /// <summary>
        /// Begins or continues playback of an animation.
        /// </summary>
        public void PlayAnimation(Animation animation)
        {
            // If this animation is already running, do not restart it.
            if (Animation == animation)
                return;

            // Start the new animation.
            this.animation = animation;
            this.frameIndex = 0;
            this.time = 0.0f;
            this.direction = 1;
        }
Exemple #10
0
 /// <summary>
 /// Loads a particular object sprite sheet.
 /// </summary>
 public virtual void LoadContent(bool isLooping = false)
 {
     // Load animations.
     string spriteLocation = @"Sprites\Objects\" + objectType;
     Texture2D spriteSheet = Session.ScreenManager.Game.Content.Load<Texture2D>(spriteLocation);
     animation = new Animation(spriteSheet, 0.1f, isLooping, parts.GetLength(0));
     sprite.PlayAnimation(animation);
 }
Exemple #11
0
        /// <summary>
        /// Load the graphics content for this screen.
        /// </summary>
        public override void LoadContent()
        {
            ContentManager content = ScreenManager.Game.Content;

            // Load textures for the menu.
            runAnimation = new Animation(content.Load<Texture2D>("Sprites/Player/Eve_running"), 0.15f, true);
            background = content.Load<Texture2D>("Backgrounds/MainMenu/Sky");
            title = content.Load<Texture2D>("Backgrounds/MainMenu/Title");
            foreground = content.Load<Texture2D>("Backgrounds/MainMenu/Cloud");
            newGameMenuEntry.Texture = content.Load<Texture2D>("Sprites/MainMenu/NewGame");
            continueMenuEntry.Texture = content.Load<Texture2D>("Sprites/MainMenu/Continue");
            extrasMenuEntry.Texture = content.Load<Texture2D>("Sprites/MainMenu/Extras");

            try
            {
                MediaPlayer.IsRepeating = true;
                MediaPlayer.Play(content.Load<Song>("Sounds/MainMenu"));
            }
            catch { }

            base.LoadContent();
        }
Exemple #12
0
        /// <summary>
        /// Loads the player sprite sheet and sounds.
        /// </summary>
        public void LoadContent()
        {
            // Load animated textures.
            idleAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/Player/Eve_idle"), 0.1f, true);
            runAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/Player/Eve_running"), 0.1f, true);
            jumpAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/Player/Eve_jumping"), 0.1f, false);
            celebrateAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/Player/Celebrate"), 0.1f, false);
            dieAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/Player/Eve_dying"), 0.1f, false);
            dashAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/Player/Eve_sliding_dash"), 0.1f, false);
            shootingAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/Player/Eve_shooting"), 0.1f, false);
            //targetDot = new Animation(Level.Content.Load<Texture2D>("Sprites/TargetDot"), 0.1f, false);

            // Calculate bounds within texture size.
            int width = (int)(idleAnimation.FrameWidth * 0.4);
            int left = (idleAnimation.FrameWidth - width) / 2;
            int height = (int)(idleAnimation.FrameWidth * 0.8);
            int top = idleAnimation.FrameHeight - height;
            localBounds = new Rectangle(left, top, width, height);

            // Load sounds.
            shootingSound = Level.Content.Load<SoundEffect>("Sounds/SlingshotFire");
            killedSound = Level.Content.Load<SoundEffect>("Sounds/PlayerKilled");
            jumpSound = Level.Content.Load<SoundEffect>("Sounds/PlayerJump");
            fallSound = Level.Content.Load<SoundEffect>("Sounds/PlayerFall");
            dashSound = Level.Content.Load<SoundEffect>("Sounds/PlayerDash");
        }