Game-Design / Sprint3_actual / Blocks / Background.cs
Background.cs
Raw
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Sprint3_actual.Blocks
{
    class Background : ISprite
    {
        private Texture2D Texture;
        private int SpriteWidth;
        private int SpriteHeight;
        private int destWidth;
        private int destHeight;
        private int SpriteX;
        private int SpriteY;
        private int SpawnX;
        private int SpawnY;

        private Rectangle sourceRectangle;
        private Rectangle destinationRectangle;

        public Background(Texture2D texture, int spawnX, int spawnY,int spriteX, int spriteY, int width, int height, int dW, int dH)
        {
            this.Texture = texture;
            this.SpriteWidth = width;
            this.SpriteHeight = height;
            this.destWidth = dW;
            this.destHeight = dH;
            this.SpriteX = spriteX;
            this.SpriteY = spriteY;
            this.SpawnX = spawnX;
            this.SpawnY = spawnY + 168;

            this.sourceRectangle = new Rectangle(SpriteX, SpriteY, SpriteWidth, SpriteHeight);
            this.destinationRectangle = new Rectangle(SpawnX, SpawnY, destWidth, destHeight);
        }

        public void draw()
        {

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

        }

        public void update(GameTime gameTime)
        {

        }
    }
}