예제 #1
0
        public void LoadContent(string spriteSet)
        {
            //Load animations.
            spriteSet = "Sprites/" + spriteSet + "/";
            this.runAnimation = new Animation(this.Level.Content.Load<Texture2D>(spriteSet + "Run monster A"), 0.1f, true);
            this.idleAnimation = new Animation(this.Level.Content.Load<Texture2D>(spriteSet + "Idle monster A"), 0.15f, true);
            this.dieAnimation = new Animation(this.Level.Content.Load<Texture2D>(spriteSet + "Die monster A"), 0.07f, false);
            this.sprite.PlayAnimation(idleAnimation);

            //Load sounds.
            this.killedSound = this.Level.Content.Load<SoundEffect>("Sounds/Horse grunt 1");

            //Calculate bounds within texture size.
            int width = (int)(this.idleAnimation.FrameWidth * 0.35);
            int left = (this.idleAnimation.FrameWidth - width) / 2;
            int height = (int)(this.idleAnimation.FrameWidth * 0.7);
            int top = this.idleAnimation.FrameHeight - height;
            this.localBounds = new Rectangle(left, top, width, height);
        }
예제 #2
0
        /// Loads the player sprite sheet and sounds.
        public void LoadContent()
        {
            // Load animated textures.
            idleAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/mysprites/idle2"), 0.1f, true);
            runAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/mysprites/walk2"), 0.1f, true);
            jumpAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/mysprites/Jump2"), 0.1f, false);
            celebrateAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/mysprites/idle2"), 0.1f, false);
            dieAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/mysprites/damage2"), 0.1f, false);
            attackAnimation = new Animation(level.Content.Load<Texture2D>("Sprites/mysprites/attack2"), 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.
            killedSound = Level.Content.Load<SoundEffect>("Sounds/Horse grunt 3");
            jumpSound = Level.Content.Load<SoundEffect>("Sounds/Grunt");
            fallSound = Level.Content.Load<SoundEffect>("Sounds/Grunt");
        }