Game-Design / Sprint2 / Sprint2_actual / Everything NPC / OldManSprite.cs
OldManSprite.cs
Raw
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using System;
using System.Collections.Generic;
using System.Text;

namespace Sprint2_actual
{
    class OldManSprite : ISprite
    {
        public Texture2D Texture { get; set; }
        public int OscillatingFramesNum { get; set; }
        public int SpriteWidth { get; set; }
        public int SpriteHeight { get; set; }
        public int SpriteX { get; set; }
        public int SpriteY { get; set; }

        private int StartingPosX { get; set; }

        public Vector2 drawPos;
        private int currentFrame;
        private int spriteSpeed;
        private bool advancing;

        public OldManSprite(Texture2D texture, int framesNum, int posX, int posY, int width, int height, int drawPosX, int drawPosY)
        {
            Texture = texture;
            SpriteWidth = width;
            SpriteHeight = height;
            SpriteX = posX;
            SpriteY = posY;
            StartingPosX = drawPosX;
            drawPos = new Vector2(drawPosX, drawPosY);
        }

        public void draw()
        {
            Rectangle sourceRectangle = new Rectangle(SpriteX + (currentFrame * SpriteWidth), SpriteY, SpriteWidth, SpriteHeight);
            Rectangle destinationRectangle = new Rectangle((int)drawPos.X, (int)drawPos.Y, 2*SpriteWidth, 2*SpriteHeight);

            GlobalVars.spriteBatch.Draw(Texture, destinationRectangle, sourceRectangle, Color.White);
        }

        public void update(GameTime gameTime)
        {
           //Old Man is only a texture.
        }
    }
}