3

Ok so my problem is that: this shows a small outline between tiles that isn't there on the spritesheet

I've tried adding a space between tiles on the spritesheet, it just changed the outline from the adjacent tile to a slightly lighter version of the edge, I think it's anti - aliasing but my spritebatch.Begin is:

spriteBatch.Begin(SpriteSortMode.FrontToBack, null, SamplerState.PointClamp, null, null, null, Main.cam.Completetransformation() * Main.DrawScaling);

SpriteBatch.Begin is called in the base Draw() and the Image.Draw() is where spriteBatch.Draw() is called

and my Image class runs like this:

                        Image.LayerDepth = layerDepth;
                        Image.Position = tile.position;
                        Image.SourceRect = tile.SourceRect;
                        Image.Color = tile.Color;

                        Image.Draw(spriteBatch);

and Image.Draw(SpriteBatch spriteBatch):

        public void Draw(SpriteBatch spriteBatch)
        {
                origin = Vector2.Zero;
                spriteBatch.Draw(Texture, Position, SourceRect, Color * Alpha, 0.0f, origin, Scale, SpriteEffects.None, LayerDepth / 100);
        }

I've googled different spritebatch begin modes ect and I have no Idea what I"m missing, the SourceRect is 32 * 32 at all times (equal to the tile size) and I haven't found an issue with position so I'm all out of ideas

Edit: I do also have

            Graphics.PreferMultiSampling = false;
            Graphics.ApplyChanges();

In my Initialize()

Kogsey
  • 31
  • 3
  • Can we see the Draw() method where Image.Draw() is called? Assume that's where SpriteBatch.Begin() is located. – Steven Jan 12 '21 at 11:22
  • That's the "public void draw" method it is within the 'Image' class, the SpriteBatch.Begin() is called earlier – Kogsey Jan 12 '21 at 12:31
  • in `spriteBatch.Draw()` method, the `Position` is a `Vector2D`, right? What is the exact dimension you need to render in your game? – AzuxirenLeadGuy Aug 19 '21 at 03:11
  • Each tile is exactly 32*32, with pixels of 2*2, so it looks 16*16, I've tried with rects of 32*32, of 31.99999 - 31.66666, and its all the same, the entire tilemap is draw from the origin of 0 and translated with a matrix on draw – Kogsey Sep 05 '21 at 06:53

0 Answers0