mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-02 03:15:43 +08:00
docs: Fix examples for v1.9.0 (#2757)
Fixed up some examples that needed fixing before releasing v1.9.0
This commit is contained in:
@ -27,22 +27,21 @@ class _GestureHitboxesWorld extends World with TapCallbacks {
|
||||
final shapeSize =
|
||||
Vector2.all(100) + Vector2.all(50.0).scaled(_rng.nextDouble());
|
||||
final shapeAngle = _rng.nextDouble() * 6;
|
||||
final hitbox = () {
|
||||
switch (shapeType) {
|
||||
case Shapes.circle:
|
||||
return CircleHitbox();
|
||||
case Shapes.rectangle:
|
||||
return RectangleHitbox();
|
||||
case Shapes.polygon:
|
||||
final points = [
|
||||
-Vector2.random(_rng),
|
||||
Vector2.random(_rng)..x *= -1,
|
||||
Vector2.random(_rng),
|
||||
Vector2.random(_rng)..y *= -1,
|
||||
];
|
||||
return PolygonHitbox.relative(points, parentSize: shapeSize);
|
||||
}
|
||||
}();
|
||||
ShapeHitbox hitbox;
|
||||
switch (shapeType) {
|
||||
case Shapes.circle:
|
||||
hitbox = CircleHitbox();
|
||||
case Shapes.rectangle:
|
||||
hitbox = RectangleHitbox();
|
||||
case Shapes.polygon:
|
||||
final points = [
|
||||
-Vector2.random(_rng),
|
||||
Vector2.random(_rng)..x *= -1,
|
||||
Vector2.random(_rng),
|
||||
Vector2.random(_rng)..y *= -1,
|
||||
];
|
||||
hitbox = PolygonHitbox.relative(points, parentSize: shapeSize);
|
||||
}
|
||||
return MyShapeComponent(
|
||||
hitbox: hitbox,
|
||||
position: position,
|
||||
|
||||
Reference in New Issue
Block a user