Rename points -> intersectionPoints (#696)

This commit is contained in:
Lukas Klingsbo
2021-03-05 16:01:38 +01:00
committed by GitHub
parent e2c7a9bee8
commit 27f76d1a31
6 changed files with 12 additions and 11 deletions

View File

@@ -68,9 +68,9 @@ abstract class MyCollidable extends PositionComponent
}
@override
void onCollision(Set<Vector2> points, Collidable other) {
final averageIntersection =
points.reduce((sum, v) => sum + v) / points.length.toDouble();
void onCollision(Set<Vector2> intersectionPoints, Collidable other) {
final averageIntersection = intersectionPoints.reduce((sum, v) => sum + v) /
intersectionPoints.length.toDouble();
final collisionDirection = (averageIntersection - absoluteCenter)
..normalize()
..round();
@@ -144,7 +144,7 @@ class SnowmanPart extends HitboxCircle {
SnowmanPart(double definition, Vector2 relativePosition, Color hitColor)
: super(definition: definition) {
this.relativePosition.setFrom(relativePosition);
onCollision = (Set<Vector2> points, HitboxShape other) {
onCollision = (Set<Vector2> intersectionPoints, HitboxShape other) {
if (other.component is ScreenCollidable) {
currentColor = startColor;
} else {