refactor: removed unecessary InitialPosition

pull/212/head
alestiago 3 years ago
parent 8bcc19ca94
commit 9d59c0ebbd

@ -16,7 +16,6 @@ class LaunchRamp extends Blueprint {
LaunchRamp()
: super(
components: [
// TODO(alestiago): Is it using initialPosition?
_LaunchRampBase(),
_LaunchRampForegroundRailing(),
_LaunchRampExit()..initialPosition = Vector2(0.6, -34),
@ -28,7 +27,7 @@ class LaunchRamp extends Blueprint {
/// {@template launch_ramp_base}
/// Ramp the [Ball] is launched from at the beginning of each ball life.
/// {@endtemplate}
class _LaunchRampBase extends BodyComponent with InitialPosition, Layered {
class _LaunchRampBase extends BodyComponent with Layered {
/// {@macro launch_ramp_base}
_LaunchRampBase()
: super(
@ -103,12 +102,7 @@ class _LaunchRampBase extends BodyComponent with InitialPosition, Layered {
@override
Body createBody() {
final bodyDef = BodyDef(
position: initialPosition,
userData: this,
);
final body = world.createBody(bodyDef);
final body = world.createBody(BodyDef());
_createFixtureDefs().forEach(body.createFixture);
return body;
@ -157,7 +151,7 @@ class _LaunchRampBackgroundRailingSpriteComponent extends SpriteComponent
/// Foreground railing for the [_LaunchRampBase] to render in front of the
/// [Ball].
/// {@endtemplate}
class _LaunchRampForegroundRailing extends BodyComponent with InitialPosition {
class _LaunchRampForegroundRailing extends BodyComponent {
/// {@macro launch_ramp_foreground_railing}
_LaunchRampForegroundRailing()
: super(
@ -200,11 +194,7 @@ class _LaunchRampForegroundRailing extends BodyComponent with InitialPosition {
@override
Body createBody() {
final bodyDef = BodyDef()
..userData = this
..position = initialPosition;
final body = world.createBody(bodyDef);
final body = world.createBody(BodyDef());
_createFixtureDefs().forEach(body.createFixture);
return body;

@ -14,7 +14,6 @@ class SpaceshipRail extends Blueprint {
SpaceshipRail()
: super(
components: [
// TODO(alestiago): Investigate if it's using initial position.
_SpaceshipRailRamp(),
_SpaceshipRailExit(),
_SpaceshipRailBase(radius: 0.55)
@ -26,8 +25,7 @@ class SpaceshipRail extends Blueprint {
);
}
/// Represents the spaceship drop rail from the [Spaceship].
class _SpaceshipRailRamp extends BodyComponent with InitialPosition, Layered {
class _SpaceshipRailRamp extends BodyComponent with Layered {
_SpaceshipRailRamp()
: super(
priority: RenderPriority.spaceshipRail,
@ -112,14 +110,8 @@ class _SpaceshipRailRamp extends BodyComponent with InitialPosition, Layered {
@override
Body createBody() {
final bodyDef = BodyDef(
position: initialPosition,
userData: this,
);
final body = world.createBody(bodyDef);
final body = world.createBody(BodyDef());
_createFixtureDefs().forEach(body.createFixture);
return body;
}
@ -180,7 +172,6 @@ class _SpaceshipRailBase extends BodyComponent with InitialPosition {
final fixtureDef = FixtureDef(shape);
final bodyDef = BodyDef(
position: initialPosition,
userData: this,
);
return world.createBody(bodyDef)..createFixture(fixtureDef);

Loading…
Cancel
Save