refactor: placed drop tube and fixed layers from spaceship

pull/79/head
RuiAlonso 4 years ago
parent 482848e155
commit bc5ead350c

@ -5,18 +5,20 @@ import 'dart:ui';
import 'package:flame/extensions.dart'; import 'package:flame/extensions.dart';
import 'package:flame_forge2d/flame_forge2d.dart'; import 'package:flame_forge2d/flame_forge2d.dart';
import 'package:pinball/game/game.dart';
import 'package:pinball_components/pinball_components.dart' hide Assets; import 'package:pinball_components/pinball_components.dart' hide Assets;
/// A [Blueprint] for the spaceship exit rail. /// {@template spaceship_exit_rail}
/// A [Blueprint] for the spaceship drop tube.
/// {@endtemplate}
class SpaceshipExitRail extends Forge2DBlueprint { class SpaceshipExitRail extends Forge2DBlueprint {
/// {@macro spaceship_exit_rail}
SpaceshipExitRail({required this.position});
/// The [position] where the elements will be created
final Vector2 position;
@override @override
void build(_) { void build(_) {
final position = Vector2(
PinballGame.boardBounds.left + 17,
PinballGame.boardBounds.center.dy + 26,
);
addAllContactCallback([ addAllContactCallback([
SpaceshipExitRailEndBallContactCallback(), SpaceshipExitRailEndBallContactCallback(),
]); ]);

@ -53,7 +53,13 @@ class PinballGame extends Forge2DGame
), ),
), ),
); );
unawaited(addFromBlueprint(SpaceshipExitRail())); unawaited(
addFromBlueprint(
SpaceshipExitRail(
position: Vector2(-32.5, 28),
),
),
);
// Fix camera on the center of the board. // Fix camera on the center of the board.
camera camera

@ -92,7 +92,7 @@ class SpaceshipSaucer extends BodyComponent with InitialPosition, Layered {
/// {@endtemplate} /// {@endtemplate}
class AndroidHead extends BodyComponent with InitialPosition, Layered { class AndroidHead extends BodyComponent with InitialPosition, Layered {
/// {@macro spaceship_bridge} /// {@macro spaceship_bridge}
AndroidHead() : super(priority: 3) { AndroidHead() : super(priority: 4) {
layer = Layer.spaceship; layer = Layer.spaceship;
} }

Loading…
Cancel
Save