|
|
@ -4,6 +4,7 @@ import 'package:flame/components.dart';
|
|
|
|
import 'package:flame_forge2d/flame_forge2d.dart';
|
|
|
|
import 'package:flame_forge2d/flame_forge2d.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:pinball_components/pinball_components.dart';
|
|
|
|
import 'package:pinball_components/pinball_components.dart';
|
|
|
|
|
|
|
|
import 'package:pinball_components/src/components/bumping_behavior.dart';
|
|
|
|
import 'package:pinball_components/src/components/dash_nest_bumper/behaviors/behaviors.dart';
|
|
|
|
import 'package:pinball_components/src/components/dash_nest_bumper/behaviors/behaviors.dart';
|
|
|
|
import 'package:pinball_flame/pinball_flame.dart';
|
|
|
|
import 'package:pinball_flame/pinball_flame.dart';
|
|
|
|
|
|
|
|
|
|
|
@ -47,8 +48,11 @@ class DashNestBumper extends BodyComponent with InitialPosition {
|
|
|
|
activeAssetPath: Assets.images.dash.bumper.main.active.keyName,
|
|
|
|
activeAssetPath: Assets.images.dash.bumper.main.active.keyName,
|
|
|
|
inactiveAssetPath: Assets.images.dash.bumper.main.inactive.keyName,
|
|
|
|
inactiveAssetPath: Assets.images.dash.bumper.main.inactive.keyName,
|
|
|
|
spritePosition: Vector2(0, -0.3),
|
|
|
|
spritePosition: Vector2(0, -0.3),
|
|
|
|
children: children,
|
|
|
|
|
|
|
|
bloc: DashNestBumperCubit(),
|
|
|
|
bloc: DashNestBumperCubit(),
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
...?children,
|
|
|
|
|
|
|
|
BumpingBehavior(strength: 20),
|
|
|
|
|
|
|
|
],
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/// {@macro dash_nest_bumper}
|
|
|
|
/// {@macro dash_nest_bumper}
|
|
|
@ -60,8 +64,11 @@ class DashNestBumper extends BodyComponent with InitialPosition {
|
|
|
|
activeAssetPath: Assets.images.dash.bumper.a.active.keyName,
|
|
|
|
activeAssetPath: Assets.images.dash.bumper.a.active.keyName,
|
|
|
|
inactiveAssetPath: Assets.images.dash.bumper.a.inactive.keyName,
|
|
|
|
inactiveAssetPath: Assets.images.dash.bumper.a.inactive.keyName,
|
|
|
|
spritePosition: Vector2(0.35, -1.2),
|
|
|
|
spritePosition: Vector2(0.35, -1.2),
|
|
|
|
children: children,
|
|
|
|
|
|
|
|
bloc: DashNestBumperCubit(),
|
|
|
|
bloc: DashNestBumperCubit(),
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
...?children,
|
|
|
|
|
|
|
|
BumpingBehavior(strength: 20),
|
|
|
|
|
|
|
|
],
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/// {@macro dash_nest_bumper}
|
|
|
|
/// {@macro dash_nest_bumper}
|
|
|
@ -73,8 +80,11 @@ class DashNestBumper extends BodyComponent with InitialPosition {
|
|
|
|
activeAssetPath: Assets.images.dash.bumper.b.active.keyName,
|
|
|
|
activeAssetPath: Assets.images.dash.bumper.b.active.keyName,
|
|
|
|
inactiveAssetPath: Assets.images.dash.bumper.b.inactive.keyName,
|
|
|
|
inactiveAssetPath: Assets.images.dash.bumper.b.inactive.keyName,
|
|
|
|
spritePosition: Vector2(0.35, -1.2),
|
|
|
|
spritePosition: Vector2(0.35, -1.2),
|
|
|
|
children: children,
|
|
|
|
|
|
|
|
bloc: DashNestBumperCubit(),
|
|
|
|
bloc: DashNestBumperCubit(),
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
...?children,
|
|
|
|
|
|
|
|
BumpingBehavior(strength: 20),
|
|
|
|
|
|
|
|
],
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
/// Creates an [DashNestBumper] without any children.
|
|
|
|
/// Creates an [DashNestBumper] without any children.
|
|
|
@ -108,13 +118,11 @@ class DashNestBumper extends BodyComponent with InitialPosition {
|
|
|
|
majorRadius: _majorRadius,
|
|
|
|
majorRadius: _majorRadius,
|
|
|
|
minorRadius: _minorRadius,
|
|
|
|
minorRadius: _minorRadius,
|
|
|
|
)..rotate(math.pi / 1.9);
|
|
|
|
)..rotate(math.pi / 1.9);
|
|
|
|
final fixtureDef = FixtureDef(shape, restitution: 4);
|
|
|
|
|
|
|
|
final bodyDef = BodyDef(
|
|
|
|
final bodyDef = BodyDef(
|
|
|
|
position: initialPosition,
|
|
|
|
position: initialPosition,
|
|
|
|
userData: this,
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
return world.createBody(bodyDef)..createFixture(fixtureDef);
|
|
|
|
return world.createBody(bodyDef)..createFixtureFromShape(shape);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|