refactor: renamed Layer.jetpack to Layer.spaceshipEntranceRamp

pull/129/head
RuiAlonso 4 years ago
parent d446be4566
commit 9e4946f430

@ -53,8 +53,8 @@ enum Layer {
/// Collide only with ramps opening elements. /// Collide only with ramps opening elements.
opening, opening,
/// Collide only with Jetpack group elements. /// Collide only with Spaceship entrance ramp group elements.
jetpack, spaceshipEntranceRamp,
/// Collide only with Launcher group elements. /// Collide only with Launcher group elements.
launcher, launcher,
@ -86,7 +86,7 @@ extension LayerMaskBits on Layer {
return 0x0001; return 0x0001;
case Layer.opening: case Layer.opening:
return 0x0007; return 0x0007;
case Layer.jetpack: case Layer.spaceshipEntranceRamp:
return 0x0002; return 0x0002;
case Layer.launcher: case Layer.launcher:
return 0x0005; return 0x0005;

@ -35,7 +35,7 @@ class BigSquare extends BodyComponent with InitialPosition, Layered {
paint = Paint() paint = Paint()
..color = const Color.fromARGB(255, 8, 218, 241) ..color = const Color.fromARGB(255, 8, 218, 241)
..style = PaintingStyle.stroke; ..style = PaintingStyle.stroke;
layer = Layer.jetpack; layer = Layer.spaceshipEntranceRamp;
} }
@override @override

@ -25,7 +25,7 @@ class BasicSpaceship extends BasicGame with TapDetector {
add( add(
Ball(baseColor: Colors.blue) Ball(baseColor: Colors.blue)
..initialPosition = info.eventPosition.game ..initialPosition = info.eventPosition.game
..layer = Layer.jetpack, ..layer = Layer.spaceshipEntranceRamp,
); );
} }
} }

@ -46,14 +46,15 @@ void main() {
}); });
test('correctly sets and gets', () { test('correctly sets and gets', () {
final component = TestLayeredBodyComponent()..layer = Layer.jetpack; final component = TestLayeredBodyComponent()
expect(component.layer, Layer.jetpack); ..layer = Layer.spaceshipEntranceRamp;
expect(component.layer, Layer.spaceshipEntranceRamp);
}); });
flameTester.test( flameTester.test(
'layers correctly before being loaded', 'layers correctly before being loaded',
(game) async { (game) async {
const expectedLayer = Layer.jetpack; const expectedLayer = Layer.spaceshipEntranceRamp;
final component = TestLayeredBodyComponent()..layer = expectedLayer; final component = TestLayeredBodyComponent()..layer = expectedLayer;
await game.ensureAdd(component); await game.ensureAdd(component);
// TODO(alestiago): modify once component.loaded is available. // TODO(alestiago): modify once component.loaded is available.
@ -71,7 +72,8 @@ void main() {
'when multiple different sets', 'when multiple different sets',
(game) async { (game) async {
const expectedLayer = Layer.launcher; const expectedLayer = Layer.launcher;
final component = TestLayeredBodyComponent()..layer = Layer.jetpack; final component = TestLayeredBodyComponent()
..layer = Layer.spaceshipEntranceRamp;
expect(component.layer, isNot(equals(expectedLayer))); expect(component.layer, isNot(equals(expectedLayer)));
component.layer = expectedLayer; component.layer = expectedLayer;
@ -90,7 +92,7 @@ void main() {
flameTester.test( flameTester.test(
'layers correctly after being loaded', 'layers correctly after being loaded',
(game) async { (game) async {
const expectedLayer = Layer.jetpack; const expectedLayer = Layer.spaceshipEntranceRamp;
final component = TestLayeredBodyComponent(); final component = TestLayeredBodyComponent();
await game.ensureAdd(component); await game.ensureAdd(component);
component.layer = expectedLayer; component.layer = expectedLayer;
@ -109,7 +111,7 @@ void main() {
final component = TestLayeredBodyComponent(); final component = TestLayeredBodyComponent();
await game.ensureAdd(component); await game.ensureAdd(component);
component.layer = Layer.jetpack; component.layer = Layer.spaceshipEntranceRamp;
expect(component.layer, isNot(equals(expectedLayer))); expect(component.layer, isNot(equals(expectedLayer)));
component.layer = expectedLayer; component.layer = expectedLayer;
@ -133,7 +135,7 @@ void main() {
flameTester.test( flameTester.test(
'nested Layered children will keep their layer', 'nested Layered children will keep their layer',
(game) async { (game) async {
const parentLayer = Layer.jetpack; const parentLayer = Layer.spaceshipEntranceRamp;
const childLayer = Layer.board; const childLayer = Layer.board;
final component = TestLayeredBodyComponent()..layer = parentLayer; final component = TestLayeredBodyComponent()..layer = parentLayer;
@ -152,7 +154,7 @@ void main() {
flameTester.test( flameTester.test(
'nested children will keep their layer', 'nested children will keep their layer',
(game) async { (game) async {
const parentLayer = Layer.jetpack; const parentLayer = Layer.spaceshipEntranceRamp;
final component = TestLayeredBodyComponent()..layer = parentLayer; final component = TestLayeredBodyComponent()..layer = parentLayer;
final childComponent = TestBodyComponent(); final childComponent = TestBodyComponent();

@ -44,7 +44,7 @@ void main() {
(game) async { (game) async {
final ramp = TestRampOpening( final ramp = TestRampOpening(
orientation: RampOrientation.down, orientation: RampOrientation.down,
pathwayLayer: Layer.jetpack, pathwayLayer: Layer.spaceshipEntranceRamp,
); );
await game.ready(); await game.ready();
await game.ensureAdd(ramp); await game.ensureAdd(ramp);
@ -59,7 +59,7 @@ void main() {
(game) async { (game) async {
final ramp = TestRampOpening( final ramp = TestRampOpening(
orientation: RampOrientation.down, orientation: RampOrientation.down,
pathwayLayer: Layer.jetpack, pathwayLayer: Layer.spaceshipEntranceRamp,
); );
await game.ensureAdd(ramp); await game.ensureAdd(ramp);
@ -68,7 +68,7 @@ void main() {
); );
group('first fixture', () { group('first fixture', () {
const pathwayLayer = Layer.jetpack; const pathwayLayer = Layer.spaceshipEntranceRamp;
const openingLayer = Layer.opening; const openingLayer = Layer.opening;
flameTester.test( flameTester.test(
@ -124,7 +124,7 @@ void main() {
final body = MockBody(); final body = MockBody();
final area = TestRampOpening( final area = TestRampOpening(
orientation: RampOrientation.down, orientation: RampOrientation.down,
pathwayLayer: Layer.jetpack, pathwayLayer: Layer.spaceshipEntranceRamp,
); );
final callback = TestRampOpeningBallContactCallback(); final callback = TestRampOpeningBallContactCallback();
@ -145,7 +145,7 @@ void main() {
final body = MockBody(); final body = MockBody();
final area = TestRampOpening( final area = TestRampOpening(
orientation: RampOrientation.up, orientation: RampOrientation.up,
pathwayLayer: Layer.jetpack, pathwayLayer: Layer.spaceshipEntranceRamp,
); );
final callback = TestRampOpeningBallContactCallback(); final callback = TestRampOpeningBallContactCallback();
@ -165,7 +165,7 @@ void main() {
final body = MockBody(); final body = MockBody();
final area = TestRampOpening( final area = TestRampOpening(
orientation: RampOrientation.down, orientation: RampOrientation.down,
pathwayLayer: Layer.jetpack, pathwayLayer: Layer.spaceshipEntranceRamp,
)..initialPosition = Vector2(0, 10); )..initialPosition = Vector2(0, 10);
final callback = TestRampOpeningBallContactCallback(); final callback = TestRampOpeningBallContactCallback();
@ -189,7 +189,7 @@ void main() {
final body = MockBody(); final body = MockBody();
final area = TestRampOpening( final area = TestRampOpening(
orientation: RampOrientation.up, orientation: RampOrientation.up,
pathwayLayer: Layer.jetpack, pathwayLayer: Layer.spaceshipEntranceRamp,
)..initialPosition = Vector2(0, 10); )..initialPosition = Vector2(0, 10);
final callback = TestRampOpeningBallContactCallback(); final callback = TestRampOpeningBallContactCallback();
@ -213,7 +213,7 @@ void main() {
final body = MockBody(); final body = MockBody();
final area = TestRampOpening( final area = TestRampOpening(
orientation: RampOrientation.down, orientation: RampOrientation.down,
pathwayLayer: Layer.jetpack, pathwayLayer: Layer.spaceshipEntranceRamp,
)..initialPosition = Vector2(0, 10); )..initialPosition = Vector2(0, 10);
final callback = TestRampOpeningBallContactCallback(); final callback = TestRampOpeningBallContactCallback();

Loading…
Cancel
Save