Game-Design / Sprint3_actual / Link_State_Files / LinkSpriteLeftAttack.cs
LinkSpriteLeftAttack.cs
Raw
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Sprint3_actual.StateFiles;
using System;
using System.Collections.Generic;
using System.Text;

namespace Sprint3_actual
{
    class LinkSpriteLeftAttack : 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 Link link;

        public LinkSpriteLeftAttack(Link link)
        {
            Texture = link.texture;
            SpriteWidth = 27; //Width of the sprite
            SpriteHeight = 15; //Height of the sprite (longer since using sword)
            SpriteY = 77;//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
            this.link = link;
        }
        public void draw()
        {
            SpriteEffects flip = SpriteEffects.FlipHorizontally;
            Rectangle sourceRectangle = new Rectangle(SpriteX, SpriteY, SpriteWidth, SpriteHeight);
            Rectangle destinationRectangle = new Rectangle(link.linkX - 33, link.linkY, 81, 48);

            GlobalVars.spriteBatch.Draw(Texture, destinationRectangle, sourceRectangle, link.linkColor, 0f, Vector2.Zero, flip, 0f);
        }

        public void update(GameTime gameTime)
        {

        }
    }
}