I'm using Monogame to build a game and I had the camera working for a long time, I recently changed all my sprites from 64*64 to 32*32 and I'm having trouble with the camera zoom and drawing sprites (view GIF), I am using the depth property in the Spritebatch to order my sprites.
_spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend,
SamplerState.PointClamp, null, null, null, camera.TranslationMatrix);
tileMap.Draw(_spriteBatch);
sceneObjectHandler.Draw(_spriteBatch);
player.Draw(_spriteBatch);
_spriteBatch.End();
Anybody have any ideas?
If Anyone comes across this post in the future I found the solution:
When creating the translation matrix for scaling the view use:
Matrix.CreateScale(scale, scale, 1)
instead of:
Matrix.CreateScale(scale)
So that the Z-index does not affect the scaling