feat: improving the spaceship hole area (#108)

* feat: improving the spaceship hole area

* fix: lint
pull/112/head
Erick 4 years ago committed by GitHub
parent 4558acd03d
commit 0b72a28183
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -49,7 +49,7 @@ class PinballGame extends Forge2DGame
unawaited( unawaited(
addFromBlueprint( addFromBlueprint(
Spaceship( Spaceship(
position: Vector2(-25, 32), position: Vector2(-26.5, 28.5),
), ),
), ),
); );

@ -16,7 +16,7 @@ class Spaceship extends Forge2DBlueprint {
Spaceship({required this.position}); Spaceship({required this.position});
/// Total size of the spaceship. /// Total size of the spaceship.
static final size = Vector2(24, 18); static final size = Vector2(25, 19);
/// The [position] where the elements will be created /// The [position] where the elements will be created
final Vector2 position; final Vector2 position;
@ -32,8 +32,8 @@ class Spaceship extends Forge2DBlueprint {
SpaceshipSaucer()..initialPosition = position, SpaceshipSaucer()..initialPosition = position,
SpaceshipEntrance()..initialPosition = position, SpaceshipEntrance()..initialPosition = position,
AndroidHead()..initialPosition = position, AndroidHead()..initialPosition = position,
SpaceshipHole()..initialPosition = position - Vector2(4.8, 4.2), SpaceshipHole()..initialPosition = position - Vector2(5.2, 4.8),
SpaceshipHole()..initialPosition = position - Vector2(-7.2, 0.6), SpaceshipHole()..initialPosition = position - Vector2(-7.2, 0.8),
SpaceshipWall()..initialPosition = position, SpaceshipWall()..initialPosition = position,
]); ]);
} }
@ -180,16 +180,17 @@ class SpaceshipHole extends BodyComponent with InitialPosition, Layered {
@override @override
Body createBody() { Body createBody() {
renderBody = false; renderBody = false;
final circleShape = CircleShape()..radius = 1.5; final shape = ArcShape(center: Vector2(-3.5, 2), arcRadius: 6, angle: 1);
final bodyDef = BodyDef() final bodyDef = BodyDef()
..userData = this ..userData = this
..position = initialPosition ..position = initialPosition
..angle = 5.2
..type = BodyType.static; ..type = BodyType.static;
return world.createBody(bodyDef) return world.createBody(bodyDef)
..createFixture( ..createFixture(
FixtureDef(circleShape)..isSensor = true, FixtureDef(shape)..isSensor = true,
); );
} }
} }

Loading…
Cancel
Save