Skip to content

Commit

Permalink
Fixes following review.
Browse files Browse the repository at this point in the history
  • Loading branch information
jessp01 committed Apr 25, 2024
1 parent 09904bb commit f243ce9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions doc/tutorials/space_shooter/step_4.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,10 @@ to be an variable accessible to the whole component since we will be accessing i
`startShooting` and `stopShooting` methods.
- We initialize our `_bulletSpawner` in the `onLoad` method. In the first argument, `period`, we set
how much time in seconds it will take between calls, and we choose `.2` seconds for now.
- We set `selfPositioning: true` so the spawn component doesn't try to position itself
- We set `selfPositioning: true` so the spawn component doesn't try to position the created component
since we want to handle that ourselves to make the bullets spawn out of the ship.
- The `factory` attribute receives a function that will be called every time the `period` is
reached and return the create component.
reached and return the created component.
- We set `autoStart: false` so it does not start by default.
- Finally we add the `_bulletSpawner` to our component, so it can be processed in the game loop.
- Note how the `_bulletSpawner` is added to the game instead of the player, since the bullets
Expand Down
18 changes: 9 additions & 9 deletions doc/tutorials/space_shooter/step_6.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ class SpaceShooterGame extends FlameGame
With that, Flame now will start to check if components have collided with each other. Next we need to
identify which components can cause collisions.

In our case those are the `Bullet` and `Enemy` components and we need to add `hitboxes` to them.
In our case those are the `Bullet` and `Enemy` components and we need to add hitboxes to them.

A `hitbox` is nothing more than a defined part of the component's area that can hit
other objects. Flame offers a collection of classes to define a `hitbox`, the simplest of them is
A hitbox is nothing more than a defined part of the component's area that can hit
other objects. Flame offers a collection of classes to define a hitbox, the simplest of them is
the `RectangleHitbox`, which like the name implies, will set a rectangular area as the component's
`hitbox`.
hitbox.

`Hitboxes` are also components, so we can simply add them to the components that we want to have `hitboxes`.
Hitboxes are also components, so we can simply add them to the components that we want to have hitboxes.
Let's start by adding the following line to the `Enemy` class:

```dart
Expand All @@ -49,9 +49,9 @@ performance!

There are three types of collisions in Flame:

- `active` collides with other `Hitbox` of type active or passive
- `passive` collides with other `Hitbox` of type active
- `inactive` will not collide with any other `Hitbox`
- `active` collides with other hitboxes of type active or passive
- `passive` collides with other hitboxes of type active
- `inactive` will not collide with any other hitbox

Usually it is smart to mark `hitboxes` from components that will have a higher number of instances
as passive, so they will be taken into account for collision, but they themselves will not check
Expand All @@ -62,7 +62,7 @@ And since in this game we anticipate that there will be more bullets than enemie
bullets to have a passive collision type!

From this point on, Flame will take care of checking the collision between those two components and
we now need to do something when these occur.
we now need to do something when this occurs.

We start by receiving the collision events in one of the classes. Since `Bullet`s have a
passive collision type, we will also add the collision checking logic to the `Enemy` class.
Expand Down

0 comments on commit f243ce9

Please sign in to comment.