mirror of
https://github.com/flame-engine/flame.git
synced 2025-10-31 00:48:47 +08:00
ShapeComponent and Hitbox to take transform of parents full ancestor tree into consideration (#1076)
* `ShapeComponent` changes size, position and angle of underlying Shape * Added description to ShapeComponent * Fix test * Update packages/flame/lib/src/components/shape_component.dart Co-authored-by: Erick <erickzanardoo@gmail.com> * Add absoluteScale and absoluteAngle to PositionComponent * Refactor ShapeComponent * Should be scaled by total scale, not scaled size * Premature optimization for creation for objects in Polygon * Use path for default Polygon constructor * Do not sync component and hitbox shape * Fix analyze issue * Add example for flipping with collision detection * Don't use absoluteScale * Fix examples * Fix examples * Doesn't need super.render * Fix Circle dartdoc * Update changelog * Update names of vertices caches in Polygon * Update text docs * Revert "Update text docs" This reverts commit 73a68a465d76eb0eb50bb3753e57b2f4e3b5a7f4. * Fix examples * ShapeComponents docs * Move example games to the top * Fix dartdoc comment about polygon vertex relation * Fix order of polygon vertices in dartdoc * Fix anchor for PolygonComponent.fromPoints * Add test with ancestors * Update doc/components.md Co-authored-by: Pasha Stetsenko <stpasha@google.com> * Update doc/components.md Co-authored-by: Erick <erickzanardoo@gmail.com> * Rename example classes * Fix linting issues in examples * Don't use px * Use isTrue and isFalse * Update doc/components.md Co-authored-by: Erick <erickzanardoo@gmail.com> * Fixed comments on PR Co-authored-by: Erick <erickzanardoo@gmail.com> Co-authored-by: Pasha Stetsenko <stpasha@google.com>
This commit is contained in:
@ -3,27 +3,34 @@ import 'package:flame/game.dart';
|
||||
|
||||
import '../../commons/commons.dart';
|
||||
import 'circles.dart';
|
||||
import 'collidable_animation.dart';
|
||||
import 'multiple_shapes.dart';
|
||||
import 'only_shapes.dart';
|
||||
import 'simple_shapes.dart';
|
||||
|
||||
void addCollisionDetectionStories(Dashbook dashbook) {
|
||||
dashbook.storiesOf('Collision Detection')
|
||||
..add(
|
||||
'Collidable AnimationComponent',
|
||||
(_) => GameWidget(game: CollidableAnimationExample()),
|
||||
codeLink: baseLink('collision_detection/collidable_animation.dart'),
|
||||
info: CollidableAnimationExample.description,
|
||||
)
|
||||
..add(
|
||||
'Circles',
|
||||
(_) => GameWidget(game: Circles()),
|
||||
(_) => GameWidget(game: CirclesExample()),
|
||||
codeLink: baseLink('collision_detection/circles.dart'),
|
||||
info: circlesInfo,
|
||||
info: CirclesExample.description,
|
||||
)
|
||||
..add(
|
||||
'Multiple shapes',
|
||||
(_) => GameWidget(game: MultipleShapes()),
|
||||
(_) => GameWidget(game: MultipleShapesExample()),
|
||||
codeLink: baseLink('collision_detection/multiple_shapes.dart'),
|
||||
info: multipleShapesInfo,
|
||||
info: MultipleShapesExample.description,
|
||||
)
|
||||
..add(
|
||||
'Simple Shapes',
|
||||
(_) => GameWidget(game: OnlyShapes()),
|
||||
codeLink: baseLink('collision_detection/only_shapes.dart'),
|
||||
info: onlyShapesInfo,
|
||||
(_) => GameWidget(game: SimpleShapesExample()),
|
||||
codeLink: baseLink('collision_detection/simple_shapes.dart'),
|
||||
info: SimpleShapesExample.description,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user