refactor: improved ramp entrance bug and modified dino index

fix/ramp-opening
RuiAlonso 3 years ago
parent f84e8eaa5b
commit c587ad13d8

@ -62,9 +62,6 @@ class _SpaceshipRampBackground extends BodyComponent
with InitialPosition, Layered, ZIndex { with InitialPosition, Layered, ZIndex {
_SpaceshipRampBackground() _SpaceshipRampBackground()
: super( : super(
/*paint: Paint()
..color = Colors.red
..strokeWidth = .3,*/
renderBody: false, renderBody: false,
children: [ children: [
_SpaceshipRampBackgroundRampSpriteComponent(), _SpaceshipRampBackgroundRampSpriteComponent(),
@ -232,9 +229,6 @@ class SpaceshipRampBoardOpening extends BodyComponent
with Layered, ZIndex, InitialPosition { with Layered, ZIndex, InitialPosition {
SpaceshipRampBoardOpening() SpaceshipRampBoardOpening()
: super( : super(
/*paint: Paint()
..color = Colors.amber
..strokeWidth = .3,*/
renderBody: false, renderBody: false,
children: [ children: [
_SpaceshipRampBoardOpeningSpriteComponent(), _SpaceshipRampBoardOpeningSpriteComponent(),
@ -247,6 +241,7 @@ class SpaceshipRampBoardOpening extends BodyComponent
)..applyTo(['outside']), )..applyTo(['outside']),
ZIndexContactBehavior( ZIndexContactBehavior(
zIndex: ZIndexes.ballOnBoard, zIndex: ZIndexes.ballOnBoard,
//onBegin: false,
)..applyTo(['outside']), )..applyTo(['outside']),
ZIndexContactBehavior(zIndex: ZIndexes.ballOnSpaceshipRamp) ZIndexContactBehavior(zIndex: ZIndexes.ballOnSpaceshipRamp)
..applyTo(['middle', 'inside']), ..applyTo(['middle', 'inside']),
@ -266,8 +261,8 @@ class SpaceshipRampBoardOpening extends BodyComponent
List<FixtureDef> _createFixtureDefs() { List<FixtureDef> _createFixtureDefs() {
final topEdge = EdgeShape() final topEdge = EdgeShape()
..set( ..set(
Vector2(-4.8, -1.2), Vector2(-3.9, -1.2),
Vector2(4.5, -1.6), Vector2(-3.9, -1.2),
); );
final bottomEdge = EdgeShape() final bottomEdge = EdgeShape()
..set( ..set(
@ -357,11 +352,8 @@ class _SpaceshipRampForegroundRailing extends BodyComponent
with InitialPosition, Layered, ZIndex { with InitialPosition, Layered, ZIndex {
_SpaceshipRampForegroundRailing() _SpaceshipRampForegroundRailing()
: super( : super(
/*paint: Paint()
..color = Colors.red
..strokeWidth = .3,*/
renderBody: false, renderBody: false,
//children: [_SpaceshipRampForegroundRailingSpriteComponent()], children: [_SpaceshipRampForegroundRailingSpriteComponent()],
) { ) {
layer = Layer.spaceshipEntranceRamp; layer = Layer.spaceshipEntranceRamp;
zIndex = ZIndexes.spaceshipRampForegroundRailing; zIndex = ZIndexes.spaceshipRampForegroundRailing;
@ -382,11 +374,13 @@ class _SpaceshipRampForegroundRailing extends BodyComponent
Vector2(0, -44.5), Vector2(0, -44.5),
], ],
); );
final boardOpeningEdgeShape = EdgeShape() final boardOpeningEdgeShape = BezierCurveShape(
..set( controlPoints: [
innerRightCurveShape.vertices.last, innerRightCurveShape.vertices.last,
Vector2(-0.85, -40.8), Vector2(.5, -42),
); Vector2(-0.83, -40),
],
);
return [ return [
FixtureDef(innerLeftCurveShape), FixtureDef(innerLeftCurveShape),

@ -54,7 +54,7 @@ abstract class ZIndexes {
// Dino Desert // Dino Desert
static const dinoTopWall = _above + ballOnBoard; static const dinoTopWall = _above + spaceshipRamp;
static const dinoTopWallTunnel = _below + ballOnBoard; static const dinoTopWallTunnel = _below + ballOnBoard;

Loading…
Cancel
Save