Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Move flame_forge2d examples to main examples (#1588)
- Loading branch information
Showing
26 changed files
with
498 additions
and
406 deletions.
There are no files selected for viewing
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
examples/lib/stories/bridge_libraries/forge2d/camera_example.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import 'package:flame/input.dart'; | ||
import 'package:flame_forge2d/flame_forge2d.dart'; | ||
|
||
import 'domino_example.dart'; | ||
import 'sprite_body_example.dart'; | ||
|
||
class CameraExample extends DominoExample { | ||
static const String description = ''' | ||
This example showcases the possibility to follow BodyComponents with the | ||
camera. When the screen is tapped a pizza is added, which the camera will | ||
follow. Other than that it is the same as the domino example. | ||
'''; | ||
|
||
@override | ||
void onTapDown(TapDownInfo details) { | ||
final position = details.eventPosition.game; | ||
final pizza = Pizza(position); | ||
add(pizza); | ||
pizza.mounted.whenComplete(() => camera.followBodyComponent(pizza)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.