|
|
@ -96,8 +96,6 @@ class _SpaceshipRampBackground extends BodyComponent
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Body createBody() {
|
|
|
|
Body createBody() {
|
|
|
|
renderBody = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final bodyDef = BodyDef()
|
|
|
|
final bodyDef = BodyDef()
|
|
|
|
..userData = this
|
|
|
|
..userData = this
|
|
|
|
..position = initialPosition;
|
|
|
|
..position = initialPosition;
|
|
|
@ -111,35 +109,40 @@ class _SpaceshipRampBackground extends BodyComponent
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Future<void> onLoad() async {
|
|
|
|
Future<void> onLoad() async {
|
|
|
|
await super.onLoad();
|
|
|
|
await super.onLoad();
|
|
|
|
await _loadSprites();
|
|
|
|
renderBody = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> _loadSprites() async {
|
|
|
|
|
|
|
|
final spriteRamp = await gameRef.loadSprite(
|
|
|
|
|
|
|
|
Assets.images.spaceship.ramp.main.keyName,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final spriteRampComponent = SpriteComponent(
|
|
|
|
await add(_SpaceshipRampBackgroundRailingSpriteComponent());
|
|
|
|
sprite: spriteRamp,
|
|
|
|
await add(_SpaceshipRampBackgroundRampSpriteComponent());
|
|
|
|
size: Vector2(38.1, 33.8),
|
|
|
|
}
|
|
|
|
anchor: Anchor.center,
|
|
|
|
}
|
|
|
|
position: Vector2(-12.2, -53.5),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final spriteRailingBg = await gameRef.loadSprite(
|
|
|
|
class _SpaceshipRampBackgroundRailingSpriteComponent extends SpriteComponent
|
|
|
|
|
|
|
|
with HasGameRef {
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
|
|
Future<void> onLoad() async {
|
|
|
|
|
|
|
|
await super.onLoad();
|
|
|
|
|
|
|
|
final sprite = await gameRef.loadSprite(
|
|
|
|
Assets.images.spaceship.ramp.railingBackground.keyName,
|
|
|
|
Assets.images.spaceship.ramp.railingBackground.keyName,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
final spriteRailingBgComponent = SpriteComponent(
|
|
|
|
this.sprite = sprite;
|
|
|
|
sprite: spriteRailingBg,
|
|
|
|
size = Vector2(38.3, 35.1);
|
|
|
|
size: Vector2(38.3, 35.1),
|
|
|
|
anchor = Anchor.center;
|
|
|
|
anchor: Anchor.center,
|
|
|
|
position = Vector2(-12.2, -54.5);
|
|
|
|
position: spriteRampComponent.position + Vector2(0, -1),
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
await addAll([
|
|
|
|
class _SpaceshipRampBackgroundRampSpriteComponent extends SpriteComponent
|
|
|
|
spriteRailingBgComponent,
|
|
|
|
with HasGameRef {
|
|
|
|
spriteRampComponent,
|
|
|
|
@override
|
|
|
|
]);
|
|
|
|
Future<void> onLoad() async {
|
|
|
|
|
|
|
|
await super.onLoad();
|
|
|
|
|
|
|
|
final sprite = await gameRef.loadSprite(
|
|
|
|
|
|
|
|
Assets.images.spaceship.ramp.main.keyName,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
this.sprite = sprite;
|
|
|
|
|
|
|
|
size = Vector2(38.3, 35.1);
|
|
|
|
|
|
|
|
anchor = Anchor.center;
|
|
|
|
|
|
|
|
position = Vector2(-12.2, -543.5);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -196,21 +199,22 @@ class _SpaceshipRampForegroundRailing extends BodyComponent
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Future<void> onLoad() async {
|
|
|
|
Future<void> onLoad() async {
|
|
|
|
await super.onLoad();
|
|
|
|
await super.onLoad();
|
|
|
|
await _loadSprites();
|
|
|
|
await add(_SpaceshipRampForegroundRalingSpriteComponent());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> _loadSprites() async {
|
|
|
|
class _SpaceshipRampForegroundRalingSpriteComponent extends SpriteComponent
|
|
|
|
final spriteRailingFg = await gameRef.loadSprite(
|
|
|
|
with HasGameRef {
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
|
|
|
Future<void> onLoad() async {
|
|
|
|
|
|
|
|
await super.onLoad();
|
|
|
|
|
|
|
|
final sprite = await gameRef.loadSprite(
|
|
|
|
Assets.images.spaceship.ramp.railingForeground.keyName,
|
|
|
|
Assets.images.spaceship.ramp.railingForeground.keyName,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
final spriteRailingFgComponent = SpriteComponent(
|
|
|
|
this.sprite = sprite;
|
|
|
|
sprite: spriteRailingFg,
|
|
|
|
size = Vector2(26.1, 28.3);
|
|
|
|
size: Vector2(26.1, 28.3),
|
|
|
|
anchor = Anchor.center;
|
|
|
|
anchor: Anchor.center,
|
|
|
|
position = Vector2(-12.2, -52.5);
|
|
|
|
position: Vector2(-12.2, -52.5),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await add(spriteRailingFgComponent);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|