chore: update assets

pull/204/head
Allison Ryan 3 years ago
parent 2d076cceca
commit 3735b06d55

@ -5,14 +5,12 @@ import 'package:flame_forge2d/flame_forge2d.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:pinball/game/game.dart'; import 'package:pinball/game/game.dart';
import 'package:pinball_components/pinball_components.dart'; import 'package:pinball_components/pinball_components.dart';
import 'package:pinball_flame/pinball_flame.dart';
/// {@template alien_zone} /// {@template alien_zone}
/// Area positioned below [Spaceship] where the [Ball] /// Area positioned below [Spaceship] where the [Ball]
/// can bounce off [AlienBumper]s. /// can bounce off [AlienBumper]s.
/// ///
/// When a [Ball] hits [AlienBumper]s, they toggle between activated and /// When a [Ball] hits an [AlienBumper], the bumper animates.
/// deactivated states.
/// {@endtemplate} /// {@endtemplate}
class AlienZone extends Component with HasGameRef<PinballGame> { class AlienZone extends Component with HasGameRef<PinballGame> {
/// {@macro alien_zone} /// {@macro alien_zone}
@ -22,12 +20,12 @@ class AlienZone extends Component with HasGameRef<PinballGame> {
Future<void> onLoad() async { Future<void> onLoad() async {
await super.onLoad(); await super.onLoad();
gameRef.addContactCallback(_ControlledAlienBumperBallContactCallback()); gameRef.addContactCallback(AlienBumperBallContactCallback());
final lowerBumper = ControlledAlienBumper.a() final lowerBumper = _AlienBumper.a()
..initialPosition = Vector2(-32.52, -9.34); ..initialPosition = Vector2(-32.52, -9.1);
final upperBumper = ControlledAlienBumper.b() final upperBumper = _AlienBumper.b()
..initialPosition = Vector2(-22.89, -17.43); ..initialPosition = Vector2(-22.89, -17.35);
await addAll([ await addAll([
lowerBumper, lowerBumper,
@ -36,60 +34,27 @@ class AlienZone extends Component with HasGameRef<PinballGame> {
} }
} }
/// {@template controlled_alien_bumper} // TODO(alestiago): Revisit ScorePoints logic once the FlameForge2D
/// [AlienBumper] with [_AlienBumperController] attached. // ContactCallback process is enhanced.
/// {@endtemplate} class _AlienBumper extends AlienBumper with ScorePoints {
@visibleForTesting _AlienBumper.a() : super.a();
class ControlledAlienBumper extends AlienBumper
with Controls<_AlienBumperController>, ScorePoints {
/// {@macro controlled_alien_bumper}
ControlledAlienBumper.a() : super.a() {
controller = _AlienBumperController(this);
}
/// {@macro controlled_alien_bumper} _AlienBumper.b() : super.b();
ControlledAlienBumper.b() : super.b() {
controller = _AlienBumperController(this);
}
@override @override
// TODO(ruimiguel): change points when get final points map.
int get points => 20; int get points => 20;
} }
/// {@template alien_bumper_controller} /// Listens when a [Ball] bounces against an [AlienBumper].
/// Controls a [AlienBumper]. @visibleForTesting
/// {@endtemplate} class AlienBumperBallContactCallback
class _AlienBumperController extends ComponentController<AlienBumper> extends ContactCallback<AlienBumper, Ball> {
with HasGameRef<PinballGame> {
/// {@macro alien_bumper_controller}
_AlienBumperController(AlienBumper alienBumper) : super(alienBumper);
/// Flag for activated state of the [AlienBumper].
///
/// Used to toggle [AlienBumper]s' state between activated and deactivated.
bool isActivated = false;
/// Registers when a [AlienBumper] is hit by a [Ball].
void hit() {
if (isActivated) {
component.deactivate();
} else {
component.activate();
}
isActivated = !isActivated;
}
}
/// Listens when a [Ball] bounces bounces against a [AlienBumper].
class _ControlledAlienBumperBallContactCallback
extends ContactCallback<Controls<_AlienBumperController>, Ball> {
@override @override
void begin( void begin(
Controls<_AlienBumperController> controlledAlienBumper, AlienBumper alienBumper,
Ball _, Ball _,
Contact __, Contact __,
) { ) {
controlledAlienBumper.controller.hit(); alienBumper.animate();
} }
} }

@ -5,14 +5,12 @@ import 'package:flame_forge2d/flame_forge2d.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:pinball/game/game.dart'; import 'package:pinball/game/game.dart';
import 'package:pinball_components/pinball_components.dart'; import 'package:pinball_components/pinball_components.dart';
import 'package:pinball_flame/pinball_flame.dart';
/// {@template sparky_fire_zone} /// {@template sparky_fire_zone}
/// Area positioned at the top left of the [Board] where the [Ball] /// Area positioned at the top left of the [Board] where the [Ball]
/// can bounce off [SparkyBumper]s. /// can bounce off [SparkyBumper]s.
/// ///
/// When a [Ball] hits [SparkyBumper]s, they toggle between activated and /// When a [Ball] hits [SparkyBumper]s, the bumper animates.
/// deactivated states.
/// {@endtemplate} /// {@endtemplate}
class SparkyFireZone extends Component with HasGameRef<PinballGame> { class SparkyFireZone extends Component with HasGameRef<PinballGame> {
/// {@macro sparky_fire_zone} /// {@macro sparky_fire_zone}
@ -22,14 +20,14 @@ class SparkyFireZone extends Component with HasGameRef<PinballGame> {
Future<void> onLoad() async { Future<void> onLoad() async {
await super.onLoad(); await super.onLoad();
gameRef.addContactCallback(_ControlledSparkyBumperBallContactCallback()); gameRef.addContactCallback(SparkyBumperBallContactCallback());
final lowerLeftBumper = ControlledSparkyBumper.a() final lowerLeftBumper = _SparkyBumper.a()
..initialPosition = Vector2(-23.15, -41.65); ..initialPosition = Vector2(-22.9, -41.65);
final upperLeftBumper = ControlledSparkyBumper.b() final upperLeftBumper = _SparkyBumper.b()
..initialPosition = Vector2(-21.25, -58.15); ..initialPosition = Vector2(-21.25, -57.9);
final rightBumper = ControlledSparkyBumper.c() final rightBumper = _SparkyBumper.c()
..initialPosition = Vector2(-3.56, -53.051); ..initialPosition = Vector2(-3.3, -52.55);
await addAll([ await addAll([
lowerLeftBumper, lowerLeftBumper,
@ -39,65 +37,29 @@ class SparkyFireZone extends Component with HasGameRef<PinballGame> {
} }
} }
/// {@template controlled_sparky_bumper} // TODO(alestiago): Revisit ScorePoints logic once the FlameForge2D
/// [SparkyBumper] with [_SparkyBumperController] attached. // ContactCallback process is enhanced.
/// {@endtemplate} class _SparkyBumper extends SparkyBumper with ScorePoints {
@visibleForTesting _SparkyBumper.a() : super.a();
class ControlledSparkyBumper extends SparkyBumper
with Controls<_SparkyBumperController>, ScorePoints {
///{@macro controlled_sparky_bumper}
ControlledSparkyBumper.a() : super.a() {
controller = _SparkyBumperController(this);
}
///{@macro controlled_sparky_bumper} _SparkyBumper.b() : super.b();
ControlledSparkyBumper.b() : super.b() {
controller = _SparkyBumperController(this);
}
///{@macro controlled_sparky_bumper} _SparkyBumper.c() : super.c();
ControlledSparkyBumper.c() : super.c() {
controller = _SparkyBumperController(this);
}
@override @override
int get points => 20; int get points => 20;
} }
/// {@template sparky_bumper_controller}
/// Controls a [SparkyBumper].
/// {@endtemplate}
class _SparkyBumperController extends ComponentController<SparkyBumper>
with HasGameRef<PinballGame> {
/// {@macro sparky_bumper_controller}
_SparkyBumperController(ControlledSparkyBumper controlledSparkyBumper)
: super(controlledSparkyBumper);
/// Flag for activated state of the [SparkyBumper].
///
/// Used to toggle [SparkyBumper]s' state between activated and deactivated.
bool isActivated = false;
/// Registers when a [SparkyBumper] is hit by a [Ball].
void hit() {
if (isActivated) {
component.deactivate();
} else {
component.activate();
}
isActivated = !isActivated;
}
}
/// Listens when a [Ball] bounces bounces against a [SparkyBumper]. /// Listens when a [Ball] bounces bounces against a [SparkyBumper].
class _ControlledSparkyBumperBallContactCallback @visibleForTesting
extends ContactCallback<Controls<_SparkyBumperController>, Ball> { class SparkyBumperBallContactCallback
extends ContactCallback<SparkyBumper, Ball> {
@override @override
void begin( void begin(
Controls<_SparkyBumperController> controlledSparkyBumper, SparkyBumper sparkyBumper,
Ball _, Ball _,
Contact __, Contact __,
) { ) {
controlledSparkyBumper.controller.hit(); sparkyBumper.animate();
} }
} }

@ -44,18 +44,22 @@ extension PinballGameAssetsX on PinballGame {
), ),
images.load(components.Assets.images.spaceship.rail.main.keyName), images.load(components.Assets.images.spaceship.rail.main.keyName),
images.load(components.Assets.images.spaceship.rail.foreground.keyName), images.load(components.Assets.images.spaceship.rail.foreground.keyName),
images.load(components.Assets.images.alienBumper.a.on.keyName),
images.load(components.Assets.images.alienBumper.a.off.keyName),
images.load(components.Assets.images.alienBumper.b.on.keyName),
images.load(components.Assets.images.alienBumper.b.off.keyName),
images.load(components.Assets.images.chromeDino.mouth.keyName), images.load(components.Assets.images.chromeDino.mouth.keyName),
images.load(components.Assets.images.chromeDino.head.keyName), images.load(components.Assets.images.chromeDino.head.keyName),
images.load(components.Assets.images.plunger.plunger.keyName), images.load(components.Assets.images.plunger.plunger.keyName),
images.load(components.Assets.images.plunger.rocket.keyName), images.load(components.Assets.images.plunger.rocket.keyName),
images.load(components.Assets.images.sparky.computer.base.keyName), images.load(components.Assets.images.sparky.computer.base.keyName),
images.load(components.Assets.images.sparky.computer.top.keyName), images.load(components.Assets.images.sparky.computer.top.keyName),
images.load(components.Assets.images.sparky.bumper.a.active.keyName), images.load(components.Assets.images.sparky.bumper.a.on.keyName),
images.load(components.Assets.images.sparky.bumper.a.inactive.keyName), images.load(components.Assets.images.sparky.bumper.a.off.keyName),
images.load(components.Assets.images.sparky.bumper.b.active.keyName), images.load(components.Assets.images.sparky.bumper.b.on.keyName),
images.load(components.Assets.images.sparky.bumper.b.inactive.keyName), images.load(components.Assets.images.sparky.bumper.b.off.keyName),
images.load(components.Assets.images.sparky.bumper.c.active.keyName), images.load(components.Assets.images.sparky.bumper.c.on.keyName),
images.load(components.Assets.images.sparky.bumper.c.inactive.keyName), images.load(components.Assets.images.sparky.bumper.c.off.keyName),
images.load(components.Assets.images.backboard.backboardScores.keyName), images.load(components.Assets.images.backboard.backboardScores.keyName),
images.load(components.Assets.images.backboard.backboardGameOver.keyName), images.load(components.Assets.images.backboard.backboardGameOver.keyName),
images.load(components.Assets.images.googleWord.letter1.keyName), images.load(components.Assets.images.googleWord.letter1.keyName),

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

@ -236,25 +236,25 @@ class $AssetsImagesSparkyGen {
class $AssetsImagesAlienBumperAGen { class $AssetsImagesAlienBumperAGen {
const $AssetsImagesAlienBumperAGen(); const $AssetsImagesAlienBumperAGen();
/// File path: assets/images/alien_bumper/a/active.png /// File path: assets/images/alien_bumper/a/off.png
AssetGenImage get active => AssetGenImage get off =>
const AssetGenImage('assets/images/alien_bumper/a/active.png'); const AssetGenImage('assets/images/alien_bumper/a/off.png');
/// File path: assets/images/alien_bumper/a/inactive.png /// File path: assets/images/alien_bumper/a/on.png
AssetGenImage get inactive => AssetGenImage get on =>
const AssetGenImage('assets/images/alien_bumper/a/inactive.png'); const AssetGenImage('assets/images/alien_bumper/a/on.png');
} }
class $AssetsImagesAlienBumperBGen { class $AssetsImagesAlienBumperBGen {
const $AssetsImagesAlienBumperBGen(); const $AssetsImagesAlienBumperBGen();
/// File path: assets/images/alien_bumper/b/active.png /// File path: assets/images/alien_bumper/b/off.png
AssetGenImage get active => AssetGenImage get off =>
const AssetGenImage('assets/images/alien_bumper/b/active.png'); const AssetGenImage('assets/images/alien_bumper/b/off.png');
/// File path: assets/images/alien_bumper/b/inactive.png /// File path: assets/images/alien_bumper/b/on.png
AssetGenImage get inactive => AssetGenImage get on =>
const AssetGenImage('assets/images/alien_bumper/b/inactive.png'); const AssetGenImage('assets/images/alien_bumper/b/on.png');
} }
class $AssetsImagesDashBumperGen { class $AssetsImagesDashBumperGen {
@ -309,8 +309,11 @@ class $AssetsImagesSparkyBumperGen {
class $AssetsImagesSparkyComputerGen { class $AssetsImagesSparkyComputerGen {
const $AssetsImagesSparkyComputerGen(); const $AssetsImagesSparkyComputerGen();
/// File path: assets/images/sparky/computer/base.png
AssetGenImage get base => AssetGenImage get base =>
const AssetGenImage('assets/images/sparky/computer/base.png'); const AssetGenImage('assets/images/sparky/computer/base.png');
/// File path: assets/images/sparky/computer/top.png
AssetGenImage get top => AssetGenImage get top =>
const AssetGenImage('assets/images/sparky/computer/top.png'); const AssetGenImage('assets/images/sparky/computer/top.png');
} }
@ -354,28 +357,37 @@ class $AssetsImagesDashBumperMainGen {
class $AssetsImagesSparkyBumperAGen { class $AssetsImagesSparkyBumperAGen {
const $AssetsImagesSparkyBumperAGen(); const $AssetsImagesSparkyBumperAGen();
AssetGenImage get active => /// File path: assets/images/sparky/bumper/a/off.png
const AssetGenImage('assets/images/sparky/bumper/a/active.png'); AssetGenImage get off =>
AssetGenImage get inactive => const AssetGenImage('assets/images/sparky/bumper/a/off.png');
const AssetGenImage('assets/images/sparky/bumper/a/inactive.png');
/// File path: assets/images/sparky/bumper/a/on.png
AssetGenImage get on =>
const AssetGenImage('assets/images/sparky/bumper/a/on.png');
} }
class $AssetsImagesSparkyBumperBGen { class $AssetsImagesSparkyBumperBGen {
const $AssetsImagesSparkyBumperBGen(); const $AssetsImagesSparkyBumperBGen();
AssetGenImage get active => /// File path: assets/images/sparky/bumper/b/off.png
const AssetGenImage('assets/images/sparky/bumper/b/active.png'); AssetGenImage get off =>
AssetGenImage get inactive => const AssetGenImage('assets/images/sparky/bumper/b/off.png');
const AssetGenImage('assets/images/sparky/bumper/b/inactive.png');
/// File path: assets/images/sparky/bumper/a/on.png
AssetGenImage get on =>
const AssetGenImage('assets/images/sparky/bumper/b/on.png');
} }
class $AssetsImagesSparkyBumperCGen { class $AssetsImagesSparkyBumperCGen {
const $AssetsImagesSparkyBumperCGen(); const $AssetsImagesSparkyBumperCGen();
AssetGenImage get active => /// File path: assets/images/sparky/bumper/c/off.png
const AssetGenImage('assets/images/sparky/bumper/c/active.png'); AssetGenImage get off =>
AssetGenImage get inactive => const AssetGenImage('assets/images/sparky/bumper/c/off.png');
const AssetGenImage('assets/images/sparky/bumper/c/inactive.png');
/// File path: assets/images/sparky/bumper/c/on.png
AssetGenImage get on =>
const AssetGenImage('assets/images/sparky/bumper/c/on.png');
} }
class Assets { class Assets {

Loading…
Cancel
Save