Skip to content

Commit

Permalink
fix: Adjust platformer tutorial steps (#2845)
Browse files Browse the repository at this point in the history
This small PR adjusts:
1. some `backticks` (`) in the platformer tutorial in order to have a
proper highlight of the file names.
2. replaces backslash (`\`) with slash (`/`) in order to be consistent
with the other file paths used in the tutorial.
3. renames the variable `_xOffset` to `xOffset` in order to be
consistent with the rest of the code.

Co-authored-by: Rodrigo Castro <rodrigo.desouzacastro@bahag.com>
  • Loading branch information
castrors and bahag-desouzacastror committed Nov 7, 2023
1 parent 997dec2 commit 10df590
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion doc/tutorials/platformer/step_2.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class EmberQuestGame extends FlameGame {
As I mentioned in the [assets](step_1.md#assets) section, we are using multiple individual image
files and for performance reasons, we should leverage Flame's built-in caching system which will
only load the files once, but allow us to access them as many times as needed without an impact to
the game. `await images.loadAll()` takes a list of the file names that are found in `assets\images`
the game. `await images.loadAll()` takes a list of the file names that are found in `assets/images`
and loads them to cache.


Expand Down
2 changes: 1 addition & 1 deletion doc/tutorials/platformer/step_3.md
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ Now we just need to finish the `onLoad` method. So make your `onLoad` method loo
void onLoad() {
final platformImage = game.images.fromCache('block.png');
sprite = Sprite(platformImage);
position = Vector2((gridPosition.x * size.x) + _xOffset,
position = Vector2((gridPosition.x * size.x) + xOffset,
game.size.y - (gridPosition.y * size.y),
);
add(RectangleHitbox(collisionType: CollisionType.passive));
Expand Down
2 changes: 1 addition & 1 deletion doc/tutorials/platformer/step_5.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ If you were waiting for some serious coding, this chapter is it. Prepare yoursel
The first step will be to allow control of Ember via the keyboard. We need to start by adding the
appropriate mixins to the game class and Ember. Add the following:

`lib/ember_quest.dart'
`lib/ember_quest.dart`

```dart
import 'package:flame/events.dart';
Expand Down
2 changes: 1 addition & 1 deletion doc/tutorials/platformer/step_6.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class Hud extends PositionComponent with HasGameRef<EmberQuestGame> {
In the `onLoad` method, you can see where we loop from 1 to the `game.health` amount, to create
the number of hearts necessary. The last step is to add the hud to the game.

Go to 'lib/ember_quest.dart` and add the following code in the `initializeGame` method:
Go to `lib/ember_quest.dart` and add the following code in the `initializeGame` method:

```dart
cameraComponent.viewport.add(Hud());
Expand Down

0 comments on commit 10df590

Please sign in to comment.