From 8e948307edd65db57b5fe10797868c1e4f5837e3 Mon Sep 17 00:00:00 2001 From: Miguel Sosa <85181687+msosav@users.noreply.github.com> Date: Thu, 4 Sep 2025 13:12:45 -0500 Subject: [PATCH 1/4] Update tutorial for drawing masked sprite backgrounds --- .../howto/graphics/HowTo_Draw_Sprite_Background.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/articles/getting_to_know/howto/graphics/HowTo_Draw_Sprite_Background.md b/articles/getting_to_know/howto/graphics/HowTo_Draw_Sprite_Background.md index d3c156b3..f47804da 100644 --- a/articles/getting_to_know/howto/graphics/HowTo_Draw_Sprite_Background.md +++ b/articles/getting_to_know/howto/graphics/HowTo_Draw_Sprite_Background.md @@ -70,7 +70,7 @@ Save the textures to your content project and name it "**AnimatedCharacter**" (t GraphicsDevice.Clear(Color.CornflowerBlue); _spriteBatch.Begin(blendState: BlendState.Opaque); - _spriteBatch.Draw (starTexture); + _spriteBatch.Draw(starTexture, Vector2.Zero, Color.White); _spriteBatch.End(); } ``` @@ -88,7 +88,7 @@ Save the textures to your content project and name it "**AnimatedCharacter**" (t public override void Draw (GameTime game) { _spriteBatch.Begin(blendState: BlendState.Opaque); - _spriteBatch.Draw (starTexture); + _spriteBatch.Draw(starTexture, Vector2.Zero, Color.White); _spriteBatch.End(); _spriteBatch.Begin(blendState: BlendState.AlphaBlend); @@ -117,3 +117,4 @@ Try using this technique on top of the [How To Make A Scrolling Background](HowT - [SpriteBatch](xref:Microsoft.Xna.Framework.Graphics.SpriteBatch) - [SpriteBatch.Draw](xref:Microsoft.Xna.Framework.Graphics.SpriteBatch#Microsoft_Xna_Framework_Graphics_SpriteBatch_Draw_Microsoft_Xna_Framework_Graphics_Texture2D_Microsoft_Xna_Framework_Vector2_Microsoft_Xna_Framework_Color_) - [Texture2D](xref:Microsoft.Xna.Framework.Graphics.Texture2D) + From 997f1a9a15bfd69f9349eff98c30c4368043e3a9 Mon Sep 17 00:00:00 2001 From: Miguel Sosa <85181687+msosav@users.noreply.github.com> Date: Sun, 7 Sep 2025 20:48:08 -0500 Subject: [PATCH 2/4] Add note on revising the How to draw a Sprite topic --- .../howto/graphics/HowTo_Draw_Sprite_Background.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/articles/getting_to_know/howto/graphics/HowTo_Draw_Sprite_Background.md b/articles/getting_to_know/howto/graphics/HowTo_Draw_Sprite_Background.md index f47804da..18bdcda2 100644 --- a/articles/getting_to_know/howto/graphics/HowTo_Draw_Sprite_Background.md +++ b/articles/getting_to_know/howto/graphics/HowTo_Draw_Sprite_Background.md @@ -21,6 +21,9 @@ The example assumes the texture you are loading contains multiple images, one fo Save the textures to your content project and name it "**AnimatedCharacter**" (this name will used to reference it in the project). +> [!NOTE] +> The tutorial assumes you have already viewed the [How to draw a Sprite](https://docs.monogame.net/articles/getting_to_know/howto/graphics/HowTo_Draw_A_Sprite.html) topic. + > [!IMPORTANT] > The foreground sprite in this example must include masking information, e.g. a PNG or DDS file that supports transparency / an alpha channel. @@ -118,3 +121,4 @@ Try using this technique on top of the [How To Make A Scrolling Background](HowT - [SpriteBatch.Draw](xref:Microsoft.Xna.Framework.Graphics.SpriteBatch#Microsoft_Xna_Framework_Graphics_SpriteBatch_Draw_Microsoft_Xna_Framework_Graphics_Texture2D_Microsoft_Xna_Framework_Vector2_Microsoft_Xna_Framework_Color_) - [Texture2D](xref:Microsoft.Xna.Framework.Graphics.Texture2D) + From c57614a17c0dfa68993a8192e2751c091d5e30eb Mon Sep 17 00:00:00 2001 From: Miguel Sosa <85181687+msosav@users.noreply.github.com> Date: Sun, 7 Sep 2025 20:54:44 -0500 Subject: [PATCH 3/4] Add additional link to How to Tint a Sprite guide --- articles/getting_to_know/howto/graphics/HowTo_Draw_A_Sprite.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/articles/getting_to_know/howto/graphics/HowTo_Draw_A_Sprite.md b/articles/getting_to_know/howto/graphics/HowTo_Draw_A_Sprite.md index 958c8e49..4f83fcf5 100644 --- a/articles/getting_to_know/howto/graphics/HowTo_Draw_A_Sprite.md +++ b/articles/getting_to_know/howto/graphics/HowTo_Draw_A_Sprite.md @@ -54,7 +54,7 @@ Save it to your content project and name it "**Character**" (this name will used 5. Call [SpriteBatch.Draw](xref:Microsoft.Xna.Framework.Graphics.SpriteBatch#Microsoft_Xna_Framework_Graphics_SpriteBatch_Draw_Microsoft_Xna_Framework_Graphics_Texture2D_Microsoft_Xna_Framework_Vector2_Microsoft_Xna_Framework_Color_) on your [SpriteBatch](xref:Microsoft.Xna.Framework.Graphics.SpriteBatch) object, passing the texture to draw, the screen position, and the color to apply. > [!TIP] - > [Color.White](xref:Microsoft.Xna.Framework.Color) is used to draw the texture without any color effects. + > [Color.White](xref:Microsoft.Xna.Framework.Color) is used to draw the texture without any color effects. For a deeper explanation of how sprite tinting works, check out the [How to Tint a Sprite](https://docs.monogame.net/articles/getting_to_know/howto/graphics/HowTo_Tint_Sprite.html) guide. 6. When all the sprites have been drawn, call [SpriteBatch.End](xref:Microsoft.Xna.Framework.Graphics.SpriteBatch#Microsoft_Xna_Framework_Graphics_SpriteBatch_End) on your [SpriteBatch](xref:Microsoft.Xna.Framework.Graphics.SpriteBatch) object. @@ -130,3 +130,4 @@ See [How to detect input](../input/index.md) for more information on working wit - [Texture2D](xref:Microsoft.Xna.Framework.Graphics.Texture2D) (Character by `upklyak` from [FreePik](https://www.freepik.com/free-vector/cartoon-alien-character-animation-sprite-sheet_33397951.htm)) + From 95d52683413628d6a64d447d604c77446a9ca750 Mon Sep 17 00:00:00 2001 From: Miguel Date: Tue, 9 Sep 2025 09:10:08 -0500 Subject: [PATCH 4/4] Add relative links instead of hardcoded ones --- .../getting_to_know/howto/graphics/HowTo_Draw_A_Sprite.md | 4 ++-- .../howto/graphics/HowTo_Draw_Sprite_Background.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/articles/getting_to_know/howto/graphics/HowTo_Draw_A_Sprite.md b/articles/getting_to_know/howto/graphics/HowTo_Draw_A_Sprite.md index 4f83fcf5..ad6ccede 100644 --- a/articles/getting_to_know/howto/graphics/HowTo_Draw_A_Sprite.md +++ b/articles/getting_to_know/howto/graphics/HowTo_Draw_A_Sprite.md @@ -21,7 +21,7 @@ The following texture will be used to render to the screen. Save it to your content project and name it "**Character**" (this name will used to reference it in the project). > [!NOTE] -> The tutorial assumes you have already [created a new MonoGame project](https://docs.monogame.net/articles/getting_started/index.html#2-creating-a-new-project) using one of the standard templates. +> The tutorial assumes you have already [created a new MonoGame project](../../../getting_started/index.md#setting-up-and-creating-your-first-monogame-project) using one of the standard templates. ## To draw a sprite on screen @@ -54,7 +54,7 @@ Save it to your content project and name it "**Character**" (this name will used 5. Call [SpriteBatch.Draw](xref:Microsoft.Xna.Framework.Graphics.SpriteBatch#Microsoft_Xna_Framework_Graphics_SpriteBatch_Draw_Microsoft_Xna_Framework_Graphics_Texture2D_Microsoft_Xna_Framework_Vector2_Microsoft_Xna_Framework_Color_) on your [SpriteBatch](xref:Microsoft.Xna.Framework.Graphics.SpriteBatch) object, passing the texture to draw, the screen position, and the color to apply. > [!TIP] - > [Color.White](xref:Microsoft.Xna.Framework.Color) is used to draw the texture without any color effects. For a deeper explanation of how sprite tinting works, check out the [How to Tint a Sprite](https://docs.monogame.net/articles/getting_to_know/howto/graphics/HowTo_Tint_Sprite.html) guide. + > [Color.White](xref:Microsoft.Xna.Framework.Color) is used to draw the texture without any color effects. For a deeper explanation of how sprite tinting works, check out the [How to Tint a Sprite](HowTo_Tint_Sprite.md) guide. 6. When all the sprites have been drawn, call [SpriteBatch.End](xref:Microsoft.Xna.Framework.Graphics.SpriteBatch#Microsoft_Xna_Framework_Graphics_SpriteBatch_End) on your [SpriteBatch](xref:Microsoft.Xna.Framework.Graphics.SpriteBatch) object. diff --git a/articles/getting_to_know/howto/graphics/HowTo_Draw_Sprite_Background.md b/articles/getting_to_know/howto/graphics/HowTo_Draw_Sprite_Background.md index 18bdcda2..8d36498f 100644 --- a/articles/getting_to_know/howto/graphics/HowTo_Draw_Sprite_Background.md +++ b/articles/getting_to_know/howto/graphics/HowTo_Draw_Sprite_Background.md @@ -22,7 +22,7 @@ The example assumes the texture you are loading contains multiple images, one fo Save the textures to your content project and name it "**AnimatedCharacter**" (this name will used to reference it in the project). > [!NOTE] -> The tutorial assumes you have already viewed the [How to draw a Sprite](https://docs.monogame.net/articles/getting_to_know/howto/graphics/HowTo_Draw_A_Sprite.html) topic. +> The tutorial assumes you have already viewed the [How to draw a Sprite](HowTo_Draw_A_Sprite.md) topic. > [!IMPORTANT] > The foreground sprite in this example must include masking information, e.g. a PNG or DDS file that supports transparency / an alpha channel.