Skip to content

Commit 1b92f8b

Browse files
committed
Various small fixes (spelling, grammar, formatting, broken url, etc)
1 parent 9f6c6f3 commit 1b92f8b

13 files changed

Lines changed: 25 additions & 24 deletions

File tree

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
@@ -80,7 +80,7 @@ We are going to add this class to the class library we created in [Chapter 04](.
8080
[!code-csharp[](./snippets/textureregion.cs#declaration)]
8181

8282
> [!NOTE]
83-
> The `TextureRegion.cs` class file is placed in the *MonoGame/Graphics* folder and the class uses the `MonoGameLibrary.Graphics` [namespace](https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/types/namespaces#namespaces-overview) to keep graphics-related classes organized together. As we add more functionality to the library, we will continue to use directories and namespaces to maintain a clean structure.
83+
> The `TextureRegion.cs` class file is placed in the *MonoGameLibrary/Graphics* folder and the class uses the `MonoGameLibrary.Graphics` [namespace](https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/types/namespaces#namespaces-overview) to keep graphics-related classes organized together. As we add more functionality to the library, we will continue to use directories and namespaces to maintain a clean structure.
8484
8585
We will add several components to this class in sequence. Each section below should be added to the `TextureRegion` class in the order presented between the brackets ` { } ` of the class definition. As we go through each part, the class will gradually take shape to handle all the texture handling behavior we need.
8686

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Now that we have a fully configured XML configuration for the atlas, we need to
9292

9393
[!code-csharp[](./snippets/textureatlas/add_animation_management.cs)]
9494

95-
5. Update the `FromFile` method to parse the new `<Animation>` animation definitions from the XML configuration file
95+
5. Update the `FromFile` method to parse the new `<Animation>` animation definitions from the XML configuration file:
9696

9797
[!code-csharp[](./snippets//textureatlas/update_from_file.cs?highlight=55-95)]
9898

@@ -106,7 +106,7 @@ The updated `FromFile` method now handles both region and animation definitions
106106

107107
## The AnimatedSprite Class
108108

109-
With our `Animation` class handling animation data, and the `TextureAtlas` updated to store the animation data, we can now create a class that represents an animated sprites. Since an animated sprite is essentially a sprite that changes its texture region over time, we can build upon our existing `Sprite` class through [inheritance](https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/tutorials/inheritance).
109+
With our `Animation` class handling animation data, and the `TextureAtlas` updated to store the animation data, we can now create a class that represents animated sprites. Since an animated sprite is essentially a sprite that changes its texture region over time, we can build upon our existing `Sprite` class through [inheritance](https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/tutorials/inheritance).
110110

111111
> [!NOTE]
112112
> By inheriting from `Sprite`, our `AnimatedSprite` class automatically gets all the rendering properties (position, rotation, scale, etc.) while adding new animation-specific functionality.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ Before we can add audio to our game, we need some sound files to work with. Down
160160
>
161161
> - *bounce.wav* is "Retro Impact Punch 07" by Davit Masia (<https://kronbits.itch.io/retrosfx>).
162162
> - *collect.wav* is "Retro Jump Classic 08" by Davit Masia (<https://kronbits.itch.io/retrosfx>).
163-
> - *theme.mp3* is "Exploration" by Luis Zuno ([@ansimuz](https://twitter.com/ansimuz)).
163+
> - *theme.ogg* is "Exploration" by Luis Zuno ([@ansimuz](https://twitter.com/ansimuz)).
164164
165165
Add these files to your content project using the MGCB Editor:
166166

@@ -170,7 +170,7 @@ Add these files to your content project using the MGCB Editor:
170170
4. Navigate to and select the audio files you downloaded.
171171
5. For each file that is added, check its properties in the Properties panel:
172172
- For `.wav` files, ensure the *Processor* is set to `Sound Effect`.
173-
- For `.mp3` files, ensure the *Processor* is set to `Song`.
173+
- For `.ogg` files, ensure the *Processor* is set to `Song`.
174174
6. Save the changes and close the MGCB Editor.
175175

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Think of `IDisposable` like a cleanup checklist that runs when you are finished
104104
For our `AudioController`, implementing `IDisposable` means we can ensure all sound effect instances are properly stopped and disposed when our game ends, preventing resource leaks.
105105

106106
> [!NOTE]
107-
> Fore more information on `IDisposable` and the `Dispose` method, check out the [Implementing a Dispose Method](https://learn.microsoft.com/en-us/dotnet/standard/garbage-collection/implementing-dispose) article on Microsoft Learn.
107+
> For more information on `IDisposable` and the `Dispose` method, check out the [Implementing a Dispose Method](https://learn.microsoft.com/en-us/dotnet/standard/garbage-collection/implementing-dispose) article on Microsoft Learn.
108108
109109
## Implementing the AudioController Class
110110

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class AudioController : IDisposable
2727
/// </summary>
2828
public bool IsMuted { get; private set; }
2929

30-
/// <summary>
30+
/// <summary>
3131
/// Gets or Sets the global volume of songs.
3232
/// </summary>
3333
/// <remarks>

articles/tutorials/building_2d_games/20_implementing_ui_with_gum/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ The following is a breakdown of this initialization process:
404404
405405
2. **Content Loading**: Gum needs to be made aware of which content manager to use to load assets through the content pipeline. By setting `GumService.Default.ContentLoader.XnaContentManager = Core.Content`, we tell Gum to use our game's content manager when loading assets. By using the game's existing content manager, Gum also gets the benefit of the caching that the content manager performs when loading assets.
406406
3. **Input Configuration**:
407-
* By default, all Forms controls automatically respond to mouse and touch screen input devices. We need to explicitly register keyboard and gamepad input devices by using th `FrameworkElement.KeyboardsForUiControl` and `Framework.GamePadsForUiControl` properties.
407+
* By default, all Forms controls automatically respond to mouse and touch screen input devices. We need to explicitly register keyboard and gamepad input devices by using the `FrameworkElement.KeyboardsForUiControl` and `Framework.GamePadsForUiControl` properties.
408408
* By default, Forms controls will automatically respond to tab and shift-tab for navigation. By using the `FrameworkElement.TabKeyCombos` and `FrameworkElement.TabReverseKeyCombos` properties, we can add additional key combinations for tabbing. Here we map the Up arrow for reverse tabbing and the Down arrow for forward tabbing.
409409
410410
> [!TIP]

articles/tutorials/building_2d_games/20_implementing_ui_with_gum/snippets/game1/initializegum.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ private void InitializeGum()
55
// version.
66
GumService.Default.Initialize(this, DefaultVisualsVersion.V3);
77

8-
// Tell the Gum service which content manager to use. We will tell it to
8+
// Tell the Gum service which content manager to use. We will tell it to
99
// use the global content manager from our Core.
1010
GumService.Default.ContentLoader.XnaContentManager = Core.Content;
1111

articles/tutorials/building_2d_games/20_implementing_ui_with_gum/snippets/titlescene/createoptionspanel.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
private void CreateOptionsPanel() {
1+
private void CreateOptionsPanel()
2+
{
23
_optionsPanel = new Panel();
34
_optionsPanel.Dock(Gum.Wireframe.Dock.Fill);
45
_optionsPanel.IsVisible = false;

articles/tutorials/building_2d_games/21_customizing_gum_ui/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ Finally, update the `CreatePausePanel` method so that
353353

354354
1. Instead of using a [`ColoredRectangleRuntime`](#visual-elements) for the background of the pause panel, it now uses a [`NineSliceRuntime`](#visual-elements) that uses the sprite from the texture atlas.
355355
2. The `textInstance` is updated so that it uses the custom bitmap font file.
356-
3. The `_resumeButton` and `quiteButton` are updated to use our custom [`AnimatedButton`](#the-animatedbutton-class) control instead of the default Gum `Button` Forms control.
356+
3. The `_resumeButton` and `quitButton` are updated to use our custom [`AnimatedButton`](#the-animatedbutton-class) control instead of the default Gum `Button` Forms control.
357357

358358
[!code-csharp[](./snippets/gamescene/createpausepanel.cs?highlight=12-22,26-28,33,41)]
359359

articles/tutorials/building_2d_games/22_snake_game_mechanics/index.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: "Chapter 22: Snake Game Mechanics"
33
description: "Learn how to implement classic snake-like game mechanics and organize game objects into reusable components."
44
---
55

6-
In the previous chapters, we have built all the fundamental systems needed for our game: [graphics](../07_optimizing_texture_rendering/index.md), [input](../11_input_management/index.md), [collision detection](../12_collision_detection/index.md), [audio](../15_audio_controller/index.md), [scene management](../17_scenes/index.md), and a [user interface](../19_user_interface_fundamentals/index.md). Now it is time to transform our demo into a complete experience by implementing classic snake-like game mechanics. Before we do that, we first need to define what mechanics make a snake game.
6+
In the previous chapters, we have built all the fundamental systems needed for our game: [graphics](../07_optimizing_texture_rendering/index.md), [input](../11_input_management/index.md), [collision detection](../12_collision_detection/index.md), [audio](../15_audio_controller/index.md), [scene management](../17_scenes/index.md), and a [user interface](../19_user_interface_fundamentals/index.md). Now it is time to transform our demo into a complete experience by implementing classic snake-like game mechanics. Before we do that, we first need to define what mechanics make a snake game.
77

88
In this chapter, you will:
99

@@ -36,13 +36,13 @@ In snake, players input a cardinal direction (up, down, left, and right), to ind
3636

3737
For example, if the snake is moving to the right, an invalid input would allow a player to move it to the left.  Doing so would cause the head of the snake to reverse direction and immediately collide with the first body segment. This means the only valid inputs are those where the next direction would be the same as the current direction or perpendicular to the current direction.
3838

39-
| ![Figure 22-1: An example snake with four segments, the head segment highlighted in orange, moving to the right. Arrows show that the only valid movements for the head segment are up or down (perpendicular) or to continue to the right.](./images/snake_directions.png) |
39+
| ![Figure 22-1: An example snake with four segments, the head segment highlighted in orange, moving to the right. Arrows show that the only valid movements for the head segment are up or down (perpendicular) or to continue to the right.](./images/snake_directions.png) |
4040
| :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
41-
| **Figure 22-1: An example snake with four segments, the head segment highlighted in orange, moving to the right. Arrows show that the only valid movements for the head segment are up or down (perpendicular) or to continue to the right.** |
41+
| **Figure 22-1: An example snake with four segments, the head segment highlighted in orange, moving to the right. Arrows show that the only valid movements for the head segment are up or down (perpendicular) or to continue to the right.** |
4242

4343
### Movement Cycle
4444

45-
Instead of moving every update frame while a directional input is being pressed, the snake moves only at fixed time intervals.  A timer is used to determine how much time has passed since the last movement cycle, and when it reaches a set threshold, the next movement cycle occurs.  During this movement cycle, the snake should move forward in the direction that was input by the player between the last and current movement cycles.  This creates the grid-based movement system typically found in snake-like games.
45+
Instead of moving every update frame while a directional input is being pressed, the snake moves only at fixed time intervals.  A timer is used to determine how much time has passed since the last movement cycle, and when it reaches a set threshold, the next movement cycle occurs.  During this movement cycle, the snake should move forward in the direction that was input by the player between the last and current movement cycles.  This creates the grid-based movement system typically found in snake-like games.
4646

4747
There are various methods for handling the movement, such as iterating through each segment of the snake and updating the position of that segment to move forward.  Methods such as this though are wasteful, since visually the only parts of the snake that move on the screen are the head and the tail.  
4848

@@ -284,7 +284,7 @@ This update method:
284284
> - If we reset to zero, we lose 0.04ms.
285285
> - Over time, these small losses can add up and cause inconsistent movement.
286286
>
287-
> By subtracting the threshold instead of resetting to zero, we "bank" the excess time (0.06ms in this example) for the next movement cycle.  This ensures that:
287+
> By subtracting the threshold instead of resetting to zero, we "bank" the excess time (0.04ms in this example) for the next movement cycle.  This ensures that:
288288
>
289289
> 1. Movement happens exactly at the intended frequency, maintaining consistent game speed.
290290
> 2. The visual smoothness of movement remains intact even if the game occasionally drops frames.
@@ -345,7 +345,7 @@ In the `GameObjects` folder of the *DungeonSlime* project (your main game projec
345345

346346
This code establishes the foundation for our `Bat` class. We have included the necessary using statements for MonoGame components, audio functionality, and our library references. The class is placed in the same `DungeonSlime.GameObjects` namespace as our Slime class to maintain a consistent organization.
347347

348-
Now we will build this class step by step, adding all the functionality needed for the bat to serve as the collectible object in our game. Add each of the following sections to the `Bat` class in the order they are presented.
348+
Now we will build this class step by step, adding all the functionality needed for the bat to serve as the collectible object in our game. Add each of the following sections to the `Bat` class in the order they are presented.
349349

350350
> [!NOTE]
351351
> As with the Slime class, you may encounter compiler errors until all sections are in place. These errors will be resolved once all components of the class have been added.
@@ -381,7 +381,7 @@ This is a simple constructor that requires the bat to be given the `AnimatedSpri
381381

382382
#### Bat Randomize Velocity
383383

384-
Currently, we have the `AssignRandomVelocity` method in the `GameScene` that we call to randomize the velocity of the bat after it has been eaten by the slime. We can take this method out of the `GameScene` class and put it directly into the `Bat` class itself.
384+
Currently, we have the `AssignRandomVelocity` method in the `GameScene` that we call to randomize the velocity of the bat after it has been eaten by the slime. We can take this method out of the `GameScene` class and put it directly into the `Bat` class itself.
385385

386386
Add the following method to the `Bat` class after the constructor:
387387

@@ -433,9 +433,9 @@ With the `Bat` class complete, we have now encapsulated all the behavior needed
433433
## Conclusion
434434

435435
> [!NOTE]
436-
> To the observant, you should notice that the main game screen has not been updated and therefore nothing has changed if we run the game at this point. In the next chapter we will finalize the gameplay.
436+
> To the observant, you should notice that the main game screen has not been updated and therefore nothing has changed if we run the game at this point. In the next chapter we will finalize the gameplay.
437437
438-
In this chapter, we have learned about and implemented the core mechanics of a class snake-like game. We created:
438+
In this chapter, we have learned about and implemented the core mechanics of a class snake-like game. We created:
439439

440440
- A [`GameController`](#the-gamecontroller-class) class that provides a unified input interface, separating game actions from specific input devices.
441441
- A [`SlimeSegment`](#the-slimesegment-struct) struct to efficiently store and manage individual segments of our snake-like character.

0 commit comments

Comments
 (0)