Skip to content

Commit

Permalink
Update forge2d docs (flame-engine#862)
Browse files Browse the repository at this point in the history
  • Loading branch information
spydon authored Jul 2, 2021
1 parent 86fbe27 commit dbca90b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions doc/forge2d.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ extension of the `BaseGame` class.
It is called `Forge2DGame` and it will control the adding and removal of Forge2D's `BodyComponents`
as well as your normal components.

In `Forge2DGame` the `Camera` has a zoom level set to 10 by default, so your components will be a
lot bigger than in a normal Flame game. This is due to the speed limitation in the `Forge2D` world,
which you would hit very quickly if you are using it with `zoom = 1.0`. You can easily change the
zoom level eiter by calling `super(zoom: yourZoom)` in your constructor, or do
`game.camera.zoom = yourZoom;` at a later stage.

If you are previously familiar with Box2D it can be good to know that the whole concept of the
Box2d world is mapped to `world` in the `Forge2DGame` component and every `Body` should be a
`BodyComponent`, and added to your `Forge2DGame`.
Expand All @@ -37,6 +43,11 @@ A simple `Forge2DGame` implementation examples can be seen in the
If you don't need to have a sprite on top of your body you should use the plain `BodyComponent`, for
example if you want a circle, rectangle or polygon but only painted with a Flutter `Paint`.

The `BodyComponent` is by default having `debugMode = true`, since otherwise it wouldn't show
anything after you have created a `Body` and added the `BodyComponent` to the game. If you want to
turn it off you can either override `debugMode` to set it to false or assign false to it in your
component constructor.

## SpriteBodyComponent

Often you want to render a sprite on top of the `BodyComponent` that you are going to use in your
Expand Down

0 comments on commit dbca90b

Please sign in to comment.