Example #1
0
        public SingleMaskHandler(Texture2D spriteTexture, Texture2D maskTexture)
        {
            this.spriteTexture = spriteTexture;
            this.maskTexture   = maskTexture;

            int frameWidth  = maskTexture.Width;
            int frameHeight = maskTexture.Height;

            maskFrame = SpriteUtilities.distributeFrames(1, 1, frameWidth, frameHeight)[0];

            // FOR LINK SPECIFICALLY TODO: MAKE THIS FOR ANY SPRITE
            frameWidth    = spriteTexture.Width / LinkConstants.LinkTextureRows;
            frameHeight   = spriteTexture.Height / LinkConstants.LinkTextureCols;
            originalFrame = SpriteUtilities.distributeFrames(LinkConstants.LinkTextureRows, LinkConstants.LinkTextureCols, frameWidth, frameHeight)[6];

            originalData = new Color[spriteTexture.Width * spriteTexture.Height];
            spriteTexture.GetData(originalData);

            allMaskColors        = new List <Color[]>();
            textureColorSequence = new List <Color[]>();
            textureColorSequence.Add(originalData);
            AddAllColorMasks();

            GenerateTextureMasks();
            Reset();
        }
Example #2
0
        public ZolSprite(SpriteBatch spriteBatch, Texture2D texture, int rows, int columns, Vector2 startingPosition)
        {
            this.spriteBatch = spriteBatch;
            spriteTexture    = texture;
            remainingDelay   = MovementConstants.ZolDelay;

            currentFrame = 0;

            startingFrameIndex = 0;
            endingFrameIndex   = 2;

            frameWidth  = spriteTexture.Width / columns;
            frameHeight = spriteTexture.Height / rows;
            frames      = SpriteUtilities.distributeFrames(columns, rows, frameWidth, frameHeight);

            center = startingPosition;
        }
Example #3
0
        public WallMasterSprite(SpriteBatch spriteBatch, Texture2D texture, int rows, int columns, Vector2 startingPosition)
        {
            this.spriteBatch = spriteBatch;
            spriteTexture    = texture;
            remainingDelay   = MovementConstants.WallMasterDelay;

            currentFrame = 0;

            startingFrameIndex = (int)FrameIndex.LeftUpFacing;
            endingFrameIndex   = startingFrameIndex + 2;

            frameWidth  = spriteTexture.Width / columns;
            frameHeight = spriteTexture.Height / rows;
            frames      = SpriteUtilities.distributeFrames(columns, rows, frameWidth, frameHeight);

            center = startingPosition;

            isAttacking = false;
        }
Example #4
0
        public TrapSprite(SpriteBatch spriteBatch, Texture2D texture, int rows, int columns, Vector2 startingPosition)
        {
            this.spriteBatch = spriteBatch;
            spriteTexture    = texture;
            remainingDelay   = MovementConstants.TrapDelay;

            currentFrame = 0;

            startingFrameIndex = 0;
            endingFrameIndex   = 1;

            size.X = spriteTexture.Width / columns;
            size.Y = spriteTexture.Height / rows;
            frames = SpriteUtilities.distributeFrames(columns, rows, (int)size.X, (int)size.Y);

            center = startingPosition;

            isAttacking = false;
        }
Example #5
0
        public KeeseSprite(SpriteBatch spriteBatch, Texture2D texture, int rows, int columns, Vector2 startingPosition)
        {
            this.spriteBatch = spriteBatch;
            spriteTexture    = texture;
            remainingDelay   = MovementConstants.KeeseDelay;

            totalFrames  = rows * columns;
            currentFrame = 0;

            startingFrameIndex = 0;
            endingFrameIndex   = 2;

            size.X = spriteTexture.Width / columns;
            size.Y = spriteTexture.Height / rows;
            frames = SpriteUtilities.distributeFrames(columns, rows, (int)size.X, (int)size.Y);


            center = startingPosition;
        }
Example #6
0
        public SwordWeapon(SpriteBatch batch, Texture2D texture, Vector2 startingPos, Vector2 dir, int swordType)
        {
            spriteBatch   = batch;
            spriteTexture = texture;
            center        = startingPos;

            remainingDelay    = delaySequence[0];
            this.rows         = 4;
            this.columns      = 4;
            currentFrame      = swordType * rows;
            this.swordType    = swordType;
            frameWidth        = spriteTexture.Width / columns;
            frameHeight       = spriteTexture.Height / rows;
            frames            = SpriteUtilities.distributeFrames(columns, rows, frameWidth, frameHeight);
            animationComplete = false;

            this.direction = dir;

            if (dir.X > 0)
            {
                angle = (float)(Math.PI * 1.0 / 2.0);
            }
            else if (dir.X < 0)
            {
                angle = (float)(Math.PI * 3.0 / 2.0);
            }
            else if (dir.Y > 0)
            {
                angle = (float)Math.PI;
            }
            else
            {
                angle = 0;
            }

            collisionTexture = ProjectileHandler.Instance.CreateStarAnimTexture();
            this.collidable  = new SwordCollidable(this);
        }
Example #7
0
        public GenericTextureMask(Texture2D spriteTexture, Texture2D damageSequenceTexture, int sequenceRows, int sequenceColumns, int startingColorIndex)
        {
            this.spriteTexture         = spriteTexture;
            this.damageSequenceTexture = damageSequenceTexture;

            int frameWidth  = damageSequenceTexture.Width / sequenceColumns;
            int frameHeight = damageSequenceTexture.Height / sequenceRows;

            damageFrames = SpriteUtilities.distributeFrames(sequenceColumns, sequenceRows, frameWidth, frameHeight);

            originalData = new Color[spriteTexture.Width * spriteTexture.Height];
            spriteTexture.GetData(originalData);

            this.startingColorIndex = startingColorIndex;
            isDisabled = false;

            allMaskColors        = new List <Color[]>();
            textureColorSequence = new List <Color[]>();
            AddAllColorMasks();

            GenerateTextureMasks();
            Reset();
        }
Example #8
0
        public OrangeMapHUDItem(Game1 game, Texture2D map, Texture2D roomsTexture)
        {
            this.game = game;

            this.map          = map;
            this.roomsTexture = roomsTexture;

            this.offsetX = (int)(DimensionConstants.OriginalWindowWidth / OrangeMapConstants.XOffsetScalar);
            this.offsetY = (int)(DimensionConstants.OriginalWindowHeight / OrangeMapConstants.YOffsetScalar);

            this.scaledMapWidth  = (int)(map.Bounds.Width / OrangeMapConstants.MapScalar);
            this.scaledMapHeight = (int)(map.Bounds.Height / OrangeMapConstants.MapScalar);

            this.mapPos = new Rectangle(0, 0, scaledMapWidth, scaledMapHeight);

            this.roomFrames = SpriteUtilities.distributeFrames(OrangeMapConstants.Columns, OrangeMapConstants.Rows, OrangeMapConstants.FrameWidth, OrangeMapConstants.FrameHeight);

            this.rooms = new Dictionary <Vector3, int> [4];
            for (int i = 0; i < this.rooms.Length; i++)
            {
                this.rooms[i] = new Dictionary <Vector3, int>();
            }
        }