I'm just starting to learn MonoGame. For the sake of learning, I decided to write a simple toy with a changeable game world (something like Terraria). So, I have a two-dimensional array of the world ( int[1000,1000] ). The camera takes some small piece from this array and "puts" it into an array of those blocks that need to be drawn ( int[140,140] ). When the camera moves so that an illusion of movement arises, all the blocks are drawn with a small indent relative to the player’s position. Here is the block drawing code
spriteBatch.Draw(texture, new Rectangle(((i - 10) * 10) + fractionalpartXint, ((j - 10) * 10) + fractionalpartYint, 10, 10), Color.White); Two more variables are added to the position in x and y: fractionalpartXint and fractionalpartYint respectively. These two variables are simply the first number after the comma of the player’s position. For example, a player has such coordinates: ( 10.3 ; 4,5 ) - this means that the indentation in x is 3, in y is 5.
The problem is that if the coordinates of the camera are less than 100, then all the movements of the blocks are smooth, everything is fine, but if it is more than 100, then their movements become jerky, sharp. When moving sideways, the blocks move to the right, then to the left. Moreover, at a distance of 100 from this line, the nature of the movement of the blocks does not change. Also, for clarity. Changed the initial position of the camera to (500; 10). Movement along x is jerky, along y is smooth. It is necessary to move to the coordinates (500; 120), as well as y also begins such lags.
Who has any ideas on this matter?