mirror of
https://github.com/flame-engine/flame.git
synced 2025-10-30 08:27:36 +08:00
Fix hitbox circle on flip (#1165)
This commit is contained in:
@ -39,13 +39,12 @@ class MyCollidable extends PositionComponent
|
|||||||
position: position,
|
position: position,
|
||||||
size: Vector2.all(100),
|
size: Vector2.all(100),
|
||||||
anchor: Anchor.center,
|
anchor: Anchor.center,
|
||||||
) {
|
);
|
||||||
addHitbox(HitboxCircle());
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> onLoad() async {
|
Future<void> onLoad() async {
|
||||||
await super.onLoad();
|
await super.onLoad();
|
||||||
|
addHitbox(HitboxCircle());
|
||||||
final center = gameRef.size / 2;
|
final center = gameRef.size / 2;
|
||||||
velocity = (center - position)..scaleTo(150);
|
velocity = (center - position)..scaleTo(150);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,7 @@
|
|||||||
- Fix `Parallax.load` with different loading times
|
- Fix `Parallax.load` with different loading times
|
||||||
- Fix render order of components and add tests
|
- Fix render order of components and add tests
|
||||||
- `isHud` renamed to `respectCamera`
|
- `isHud` renamed to `respectCamera`
|
||||||
|
- Fix `HitboxCircle` when component is flipped
|
||||||
|
|
||||||
## [1.0.0-releasecandidate.18]
|
## [1.0.0-releasecandidate.18]
|
||||||
- Forcing portrait and landscape mode is now supported on web
|
- Forcing portrait and landscape mode is now supported on web
|
||||||
|
|||||||
@ -43,7 +43,8 @@ class Circle extends Shape {
|
|||||||
_scaledSize
|
_scaledSize
|
||||||
..setFrom(size)
|
..setFrom(size)
|
||||||
..multiply(scale);
|
..multiply(scale);
|
||||||
return (min(_scaledSize.x, _scaledSize.y) / 2) * normalizedRadius;
|
return (min(_scaledSize.x.abs(), _scaledSize.y.abs()) / 2) *
|
||||||
|
normalizedRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This render method doesn't rotate the canvas according to angle since a
|
/// This render method doesn't rotate the canvas according to angle since a
|
||||||
|
|||||||
Reference in New Issue
Block a user