Game-Design / Sprint2 / Sprint2_actual / Link State Files / LinkSpriteUpAttack.cs
LinkSpriteUpAttack.cs
Raw
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Sprint2_actual.StateFiles;
using System;
using System.Collections.Generic;
using System.Text;

namespace Sprint2_actual
{
    class LinkSpriteUpAttack : ISprite
    {
        private Texture2D Texture { get; set; }
        private int SpriteHeight { get; set; }
        private int SpriteWidth { get; set; }
        private int SpriteX { get; set; }
        private int SpriteY { get; set; }
        private Vector2 pos;
        private Link link;

        public LinkSpriteUpAttack(Link link)
        {
            Texture = link.texture;
            SpriteWidth = 16; //Width of the sprite
            SpriteHeight = 28; //Height of the sprite (longer since using sword)
            SpriteY = 97;//Where the top left corner of the sprite is on the sprite sheet
            SpriteX = 18;//Where the top left corner of the sprite is on the sprite sheet
            pos = new Vector2(link.linkX, link.linkY);
            this.link = link;
        }
        public void draw()
        {
            Rectangle sourceRectangle = new Rectangle(SpriteX, SpriteY, SpriteWidth, SpriteHeight);
            Rectangle destinationRectangle = new Rectangle((int)pos.X - 8, (int)pos.Y - 28, 2*SpriteWidth, 2*SpriteHeight);

            GlobalVars.spriteBatch.Draw(Texture, destinationRectangle, sourceRectangle, link.linkColor);
        }

        public void update(GameTime gameTime)
        {

        }
    }
}