I used this code for a texture to repeat in a certain area,
spriteBatch.Begin( sortMode : SpriteSortMode.Deferred, samplerState : SamplerState.LinearWrap, transformMatrix : Camera2D.LevelInstance.GetViewMatrix());
     
spriteBatch.Draw(Texture, Position, Bounds, Color.White * Alpha, 0, Vector2.Zero, Scale, Orientation, 0);
spriteBatch.End();
In some Y positions works correctly
In other positions does not work
Why?
             
            
              
              
              
            
            
                
                
              
           
          
            
            
              Bounds = new Rectangle(0,0,Texture.Width,Texture.Height);
or Bounds = new Rectangle(x, y, width,height); for sprite sheet
spriteBatch.Draw(Texture, Position, Bounds, Color.White * Alpha, 0, Vector2.Zero, Scale, Orientation, 0);
             
            
              
              
              1 Like
            
            
                
                
              
           
          
            
            
              But then spriteBatch only draws the texture size and does not repeat in the defined area. 
             
            
              
              
              
            
            
                
                
              
           
          
            
            
              some options and and leave Bounds unchanged
            Rectangle srcrect = new Rectangle(0,0,Texture.Height,Texture.Height);
            Vector2 scale = new Vector2((float)Bounds.Width/srect.Width,(float)Bounds.Height/srect.Height);
            
            spriteBatch.Draw(Texture, Bounds, Color.White * Alpha);
            spriteBatch.Draw(Texture, Bounds, srcrect, Color.White * Alpha);
            spriteBatch.Draw(Texture, Position, srcrect, Color.White * Alpha, 0, Vector2.Zero, scale,SpriteEffects.None, 0);
edit: more more more
             
            
              
              
              1 Like
            
            
                
                
              
           
          
            
            
              SOLVED! Thank you for your help!  I had some problems with the scale, in other parts of the code, so it ended up messing up the code.
 I had some problems with the scale, in other parts of the code, so it ended up messing up the code.