feat: adjusted SlingShot size

pull/48/head
alestiago 4 years ago
parent d9289fdd32
commit ecf3b42a17

@ -33,18 +33,19 @@ class SlingShot extends BodyComponent {
/// left. /// left.
final BoardSide _side; final BoardSide _side;
List<FixtureDef> _createFixtureDefs() { /// The size of the [SlingShot] body.
final fixtures = <FixtureDef>[];
// TODO(alestiago): Use size from PositionedBodyComponent instead, // TODO(alestiago): Use size from PositionedBodyComponent instead,
// once a sprite is given. // once a sprite is given.
final size = Vector2(10, 10); static final Vector2 size = Vector2(6, 8);
List<FixtureDef> _createFixtureDefs() {
final fixtures = <FixtureDef>[];
// TODO(alestiago): This magic number can be deduced by specifying the // TODO(alestiago): This magic number can be deduced by specifying the
// angle and using polar coordinate system to place the bottom right // angle and using polar coordinate system to place the bottom right
// vertex. // vertex.
// Something as: y = -size.y * math.cos(angle) // Something as: y = -size.y * math.cos(angle)
const additionalIncrement = 2; const additionalIncrement = 3;
final triangleVertices = _side.isLeft final triangleVertices = _side.isLeft
? [ ? [
Vector2(0, 0), Vector2(0, 0),
@ -78,7 +79,7 @@ class SlingShot extends BodyComponent {
); );
// TODO(alestiago): Play with restitution value once game is bundled. // TODO(alestiago): Play with restitution value once game is bundled.
final kickerFixtureDef = FixtureDef(kicker) final kickerFixtureDef = FixtureDef(kicker)
..restitution = 20.0 ..restitution = 10.0
..friction = 0; ..friction = 0;
fixtures.add(kickerFixtureDef); fixtures.add(kickerFixtureDef);

Loading…
Cancel
Save