Skip to content

Commit 5df0fd7

Browse files
Merge pull request #49 from AristurtleDev/redraft/chapter-05
Redraft/chapter 05
2 parents 2a01a7c + aeace2d commit 5df0fd7

File tree

30 files changed

+1350
-664
lines changed

30 files changed

+1350
-664
lines changed

articles/tutorials/building_2d_games/05_content_pipeline/images/content-pipeline-workflow-full.svg

Lines changed: 773 additions & 1 deletion
Loading

articles/tutorials/building_2d_games/05_content_pipeline/index.md

Lines changed: 139 additions & 148 deletions
Large diffs are not rendered by default.

articles/tutorials/building_2d_games/05_content_pipeline/snippets/content_build_dir_tree.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

articles/tutorials/building_2d_games/05_content_pipeline/snippets/content_dir_tree.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

articles/tutorials/building_2d_games/05_content_pipeline/snippets/contentpaths.sh

Lines changed: 0 additions & 31 deletions
This file was deleted.

articles/tutorials/building_2d_games/05_content_pipeline/snippets/game1.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ protected override void Initialize()
2525
protected override void LoadContent()
2626
{
2727
_logo = Content.Load<Texture2D>("images/logo");
28-
base.LoadContent();
2928
}
3029

3130
protected override void Update(GameTime gameTime)

articles/tutorials/building_2d_games/05_content_pipeline/snippets/project_build_dir_tree.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.

articles/tutorials/building_2d_games/07_optimizing_texture_rendering/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ Add this texture atlas to your content project using the MGCB Editor:
191191
192192
First, we will explore creating the texture atlas and defining the texture regions directly in code. Replace the contents of `Game1.cs` with the following:
193193

194-
[!code-csharp[](./snippets/game1/textureatlas_usage.cs?highlight=5,11-15,31-47,67-77)]
194+
[!code-csharp[](./snippets/game1/textureatlas_usage.cs?highlight=5,11-15,31-47,65-75)]
195195

196196
The key changes in this implementation are:
197197

articles/tutorials/building_2d_games/07_optimizing_texture_rendering/snippets/game1/textureatlas_usage.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ protected override void LoadContent()
4545

4646
// retrieve the bat region from the atlas.
4747
_bat = atlas.GetRegion("bat");
48-
49-
base.LoadContent();
5048
}
5149

5250
protected override void Update(GameTime gameTime)

articles/tutorials/building_2d_games/07_optimizing_texture_rendering/snippets/game1/textureatlas_xml_usage.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ protected override void LoadContent()
3636

3737
// retrieve the bat region from the atlas.
3838
_bat = atlas.GetRegion("bat");
39-
40-
base.LoadContent();
4139
}
4240

4341
protected override void Update(GameTime gameTime)

articles/tutorials/building_2d_games/08_the_sprite_class/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ We can simplify this process by adding a sprite creation method to the `TextureA
7575

7676
Now we can adjust our game now to use the `Sprite` class instead of just the texture regions. Update the contents of `Game1.cs` with the following:
7777

78-
[!code-csharp[](./snippets/game1.cs?highlight=11-15,34-40,63-67)]
78+
[!code-csharp[](./snippets/game1.cs?highlight=11-15,34-40,61-65)]
7979

8080
The key changes in this implementation are:
8181

articles/tutorials/building_2d_games/08_the_sprite_class/snippets/game1.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ protected override void LoadContent()
3838
// Create the bat sprite from the atlas.
3939
_bat = atlas.CreateSprite("bat");
4040
_bat.Scale = new Vector2(4.0f, 4.0f);
41-
42-
base.LoadContent();
4341
}
4442

4543
protected override void Update(GameTime gameTime)

articles/tutorials/building_2d_games/09_the_animatedsprite_class/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ We can simplify this process by adding an animated sprite creation method to the
178178

179179
We can now adjust our game now to use the `AnimatedSprite` class to see our sprites come to life. Update the contents of `Game1.cs` with the following:
180180

181-
[!code-csharp[](./snippets/game1.cs?highlight=11-15,34-40,50-54)]
181+
[!code-csharp[](./snippets/game1.cs?highlight=11-15,34-40,48-52)]
182182

183183
Here are the key changes in this implementation:
184184

articles/tutorials/building_2d_games/09_the_animatedsprite_class/snippets/game1.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ protected override void LoadContent()
3838
// Create the bat animated sprite from the atlas.
3939
_bat = atlas.CreateAnimatedSprite("bat-animation");
4040
_bat.Scale = new Vector2(4.0f, 4.0f);
41-
42-
base.LoadContent();
4341
}
4442

4543
protected override void Update(GameTime gameTime)

articles/tutorials/building_2d_games/10_handling_input/index.md

Lines changed: 429 additions & 427 deletions
Large diffs are not rendered by default.

articles/tutorials/building_2d_games/10_handling_input/snippets/game1.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@ protected override void LoadContent()
4444
// Create the bat animated sprite from the atlas.
4545
_bat = atlas.CreateAnimatedSprite("bat-animation");
4646
_bat.Scale = new Vector2(4.0f, 4.0f);
47-
48-
base.LoadContent();
4947
}
5048

5149
protected override void Update(GameTime gameTime)

articles/tutorials/building_2d_games/11_input_management/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ The key changes to the `Core` class are:
382382

383383
Now we can update our `Game1` class to use the new input management system through the `Core` class. Open `Game1.cs` in the game project and update it to the following:
384384

385-
[!code-csharp[](./snippets/game1.cs?highlight=1,7,77,83,89,95,101,109,114,117,121,127,129-130,135,141,147,153)]
385+
[!code-csharp[](./snippets/game1.cs?highlight=6,74,80,86,92,98,106,111,114,118,124,126-127,132,138,144,150)]
386386

387387
The key changes to the `Game1` class are:
388388

articles/tutorials/building_2d_games/11_input_management/snippets/game1.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ protected override void LoadContent()
4646
// Create the bat animated sprite from the atlas.
4747
_bat = atlas.CreateAnimatedSprite("bat-animation");
4848
_bat.Scale = new Vector2(4.0f, 4.0f);
49-
50-
base.LoadContent();
5149
}
5250

5351
protected override void Update(GameTime gameTime)

articles/tutorials/building_2d_games/12_collision_detection/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ If you run the game right now and move the slime around, you will notice a few i
311311

312312
We can now implement these features using collision detection and response in our game. In the *DungeonSlime* project (your main game project), open the `Game1.cs` file and make the following changes to the `Game1` class:
313313

314-
[!code-csharp[](./snippets/game1.cs?highlight=25-29,40-45,81-181,186-198,298-299)]
314+
[!code-csharp[](./snippets/game1.cs?highlight=1,5,25-29,40-45,79-179,184-196,296-297)]
315315

316316
The key changes made here are:
317317

articles/tutorials/building_2d_games/12_collision_detection/snippets/game1.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ protected override void LoadContent()
5757
// Create the bat animated sprite from the atlas.
5858
_bat = atlas.CreateAnimatedSprite("bat-animation");
5959
_bat.Scale = new Vector2(4.0f, 4.0f);
60-
61-
base.LoadContent();
6260
}
6361

6462
protected override void Update(GameTime gameTime)

articles/tutorials/building_2d_games/13_working_with_tilemaps/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ This tilemap configuration creates a simple dungeon layout with walls around the
186186

187187
With all of the assets now in place and configured, we can update the `Game1` class to load the tilemap and draw it. We will also need to update the collision logic so that the boundary is no longer the edge of the screen, but instead the edges of the wall tiles of the tilemap. Open `Game1.cs` and make the following updates:
188188

189-
[!code-csharp[](./snippets/game1.cs?highlight=31-35,46-61,80-82,114,116,118,120,123,125,127,129,147,150,152,155,158,161,163,166,181-183,305-306)]
189+
[!code-csharp[](./snippets/game1.cs?highlight=31-35,46-61,80-82,112,114,116,128,121,123,125,127,145,148,150,153,156,159,161,164,179-181,303-304)]
190190

191191
The key changes to the `Game1` class include:
192192

articles/tutorials/building_2d_games/13_working_with_tilemaps/snippets/game1.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ protected override void LoadContent()
8080
// Create the tilemap from the XML configuration file.
8181
_tilemap = Tilemap.FromFile(Content, "images/tilemap-definition.xml");
8282
_tilemap.Scale = new Vector2(4.0f, 4.0f);
83-
84-
base.LoadContent();
8583
}
8684

8785
protected override void Update(GameTime gameTime)

articles/tutorials/building_2d_games/14_soundeffects_and_music/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ Add these files to your content project using the MGCB Editor:
175175

176176
Next, open the `Game1.cs` file and update it to the following:
177177

178-
[!code-csharp[](./snippets/game1.cs?highlight=3,6,39-43,92-111,205-206,224-225)]
178+
[!code-csharp[](./snippets/game1.cs?highlight=3,6,39-43,92-111,203-204,222-223)]
179179

180180
The key changes here are:
181181

articles/tutorials/building_2d_games/14_soundeffects_and_music/snippets/game1.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,6 @@ protected override void LoadContent()
109109

110110
// Set the theme music to repeat.
111111
MediaPlayer.IsRepeating = true;
112-
113-
base.LoadContent();
114112
}
115113

116114
protected override void Update(GameTime gameTime)

articles/tutorials/building_2d_games/15_audio_controller/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ The key changes made here are:
131131

132132
Next, update the `Game1` class to use the audio controller for audio playback. Open `Game1.cs` and make the following updates:
133133

134-
[!code-csharp[](./snippets/game1.cs?highlight=45-46,77-78,104-105,199-200,218-219,272-290)]
134+
[!code-csharp[](./snippets/game1.cs?highlight=45-46,77-78,104-105,197-198,216-217,270-288)]
135135

136136
> [!NOTE]
137137
> Note there were a lot of replacements in the `LoadContent` method, switching from loading and initializing the background Song and replacing it with a call to the new `AudioController` to do all the work managing the Song reference. Much cleaner.

articles/tutorials/building_2d_games/15_audio_controller/snippets/game1.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,6 @@ protected override void LoadContent()
103103

104104
// Load the background theme music
105105
_themeSong = Content.Load<Song>("audio/theme");
106-
107-
base.LoadContent();
108106
}
109107

110108
protected override void Update(GameTime gameTime)

articles/tutorials/building_2d_games/16_working_with_spritefonts/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ The key changes here are:
217217

218218
Finally, open the `Game1.cs` file and make the following changes:
219219

220-
[!code-csharp[](./snippets/game1.cs?highlight=48-58,93-99,129-130,246-247,391-402)]
220+
[!code-csharp[](./snippets/game1.cs?highlight=48-58,93-99,129-130,244-245,389-400)]
221221

222222
The key changes made are:
223223

articles/tutorials/building_2d_games/16_working_with_spritefonts/snippets/game1.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,6 @@ protected override void LoadContent()
127127

128128
// Load the font
129129
_font = Content.Load<SpriteFont>("fonts/04B_30");
130-
131-
base.LoadContent();
132130
}
133131

134132
protected override void Update(GameTime gameTime)

articles/tutorials/building_2d_games/17_scenes/snippets/game1.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ protected override void Initialize()
2727

2828
protected override void LoadContent()
2929
{
30-
base.LoadContent();
31-
3230
// Load the background theme music
3331
_themeSong = Content.Load<Song>("audio/theme");
3432
}

0 commit comments

Comments
 (0)