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

@ -5,14 +5,12 @@ import 'package:flame_forge2d/flame_forge2d.dart';
import 'package:flutter/material.dart';
import 'package:pinball/game/game.dart';
import 'package:pinball_components/pinball_components.dart';
import 'package:pinball_flame/pinball_flame.dart';
/// {@template sparky_fire_zone}
/// Area positioned at the top left of the [Board] where the [Ball]
/// can bounce off [SparkyBumper]s.
///
/// When a [Ball] hits [SparkyBumper]s, they toggle between activated and
/// deactivated states.
/// When a [Ball] hits [SparkyBumper]s, the bumper animates.
/// {@endtemplate}
class SparkyFireZone extends Component with HasGameRef<PinballGame> {
/// {@macro sparky_fire_zone}
@ -22,14 +20,14 @@ class SparkyFireZone extends Component with HasGameRef<PinballGame> {
Future<void> onLoad() async {
await super.onLoad();
gameRef.addContactCallback(_ControlledSparkyBumperBallContactCallback());
gameRef.addContactCallback(SparkyBumperBallContactCallback());
final lowerLeftBumper = ControlledSparkyBumper.a()
..initialPosition = Vector2(-23.15, -41.65);
final upperLeftBumper = ControlledSparkyBumper.b()
..initialPosition = Vector2(-21.25, -58.15);
final rightBumper = ControlledSparkyBumper.c()
..initialPosition = Vector2(-3.56, -53.051);
final lowerLeftBumper = _SparkyBumper.a()
..initialPosition = Vector2(-22.9, -41.65);
final upperLeftBumper = _SparkyBumper.b()
..initialPosition = Vector2(-21.25, -57.9);
final rightBumper = _SparkyBumper.c()
..initialPosition = Vector2(-3.3, -52.55);
await addAll([
lowerLeftBumper,
@ -39,65 +37,29 @@ class SparkyFireZone extends Component with HasGameRef<PinballGame> {
}
}
/// {@template controlled_sparky_bumper}
/// [SparkyBumper] with [_SparkyBumperController] attached.
/// {@endtemplate}
@visibleForTesting
class ControlledSparkyBumper extends SparkyBumper
with Controls<_SparkyBumperController>, ScorePoints {
///{@macro controlled_sparky_bumper}
ControlledSparkyBumper.a() : super.a() {
controller = _SparkyBumperController(this);
}
// TODO(alestiago): Revisit ScorePoints logic once the FlameForge2D
// ContactCallback process is enhanced.
class _SparkyBumper extends SparkyBumper with ScorePoints {
_SparkyBumper.a() : super.a();
///{@macro controlled_sparky_bumper}
ControlledSparkyBumper.b() : super.b() {
controller = _SparkyBumperController(this);
}
_SparkyBumper.b() : super.b();
///{@macro controlled_sparky_bumper}
ControlledSparkyBumper.c() : super.c() {
controller = _SparkyBumperController(this);
}
_SparkyBumper.c() : super.c();
@override
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].
class _ControlledSparkyBumperBallContactCallback
extends ContactCallback<Controls<_SparkyBumperController>, Ball> {
@visibleForTesting
class SparkyBumperBallContactCallback
extends ContactCallback<SparkyBumper, Ball> {
@override
void begin(
Controls<_SparkyBumperController> controlledSparkyBumper,
SparkyBumper sparkyBumper,
Ball _,
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.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.head.keyName),
images.load(components.Assets.images.plunger.plunger.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.top.keyName),
images.load(components.Assets.images.sparky.bumper.a.active.keyName),
images.load(components.Assets.images.sparky.bumper.a.inactive.keyName),
images.load(components.Assets.images.sparky.bumper.b.active.keyName),
images.load(components.Assets.images.sparky.bumper.b.inactive.keyName),
images.load(components.Assets.images.sparky.bumper.c.active.keyName),
images.load(components.Assets.images.sparky.bumper.c.inactive.keyName),
images.load(components.Assets.images.sparky.bumper.a.on.keyName),
images.load(components.Assets.images.sparky.bumper.a.off.keyName),
images.load(components.Assets.images.sparky.bumper.b.on.keyName),
images.load(components.Assets.images.sparky.bumper.b.off.keyName),
images.load(components.Assets.images.sparky.bumper.c.on.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.backboardGameOver.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 {
const $AssetsImagesAlienBumperAGen();
/// File path: assets/images/alien_bumper/a/active.png
AssetGenImage get active =>
const AssetGenImage('assets/images/alien_bumper/a/active.png');
/// File path: assets/images/alien_bumper/a/off.png
AssetGenImage get off =>
const AssetGenImage('assets/images/alien_bumper/a/off.png');
/// File path: assets/images/alien_bumper/a/inactive.png
AssetGenImage get inactive =>
const AssetGenImage('assets/images/alien_bumper/a/inactive.png');
/// File path: assets/images/alien_bumper/a/on.png
AssetGenImage get on =>
const AssetGenImage('assets/images/alien_bumper/a/on.png');
}
class $AssetsImagesAlienBumperBGen {
const $AssetsImagesAlienBumperBGen();
/// File path: assets/images/alien_bumper/b/active.png
AssetGenImage get active =>
const AssetGenImage('assets/images/alien_bumper/b/active.png');
/// File path: assets/images/alien_bumper/b/off.png
AssetGenImage get off =>
const AssetGenImage('assets/images/alien_bumper/b/off.png');
/// File path: assets/images/alien_bumper/b/inactive.png
AssetGenImage get inactive =>
const AssetGenImage('assets/images/alien_bumper/b/inactive.png');
/// File path: assets/images/alien_bumper/b/on.png
AssetGenImage get on =>
const AssetGenImage('assets/images/alien_bumper/b/on.png');
}
class $AssetsImagesDashBumperGen {
@ -309,8 +309,11 @@ class $AssetsImagesSparkyBumperGen {
class $AssetsImagesSparkyComputerGen {
const $AssetsImagesSparkyComputerGen();
/// File path: assets/images/sparky/computer/base.png
AssetGenImage get base =>
const AssetGenImage('assets/images/sparky/computer/base.png');
/// File path: assets/images/sparky/computer/top.png
AssetGenImage get top =>
const AssetGenImage('assets/images/sparky/computer/top.png');
}
@ -354,28 +357,37 @@ class $AssetsImagesDashBumperMainGen {
class $AssetsImagesSparkyBumperAGen {
const $AssetsImagesSparkyBumperAGen();
AssetGenImage get active =>
const AssetGenImage('assets/images/sparky/bumper/a/active.png');
AssetGenImage get inactive =>
const AssetGenImage('assets/images/sparky/bumper/a/inactive.png');
/// File path: assets/images/sparky/bumper/a/off.png
AssetGenImage get off =>
const AssetGenImage('assets/images/sparky/bumper/a/off.png');
/// File path: assets/images/sparky/bumper/a/on.png
AssetGenImage get on =>
const AssetGenImage('assets/images/sparky/bumper/a/on.png');
}
class $AssetsImagesSparkyBumperBGen {
const $AssetsImagesSparkyBumperBGen();
AssetGenImage get active =>
const AssetGenImage('assets/images/sparky/bumper/b/active.png');
AssetGenImage get inactive =>
const AssetGenImage('assets/images/sparky/bumper/b/inactive.png');
/// File path: assets/images/sparky/bumper/b/off.png
AssetGenImage get off =>
const AssetGenImage('assets/images/sparky/bumper/b/off.png');
/// File path: assets/images/sparky/bumper/a/on.png
AssetGenImage get on =>
const AssetGenImage('assets/images/sparky/bumper/b/on.png');
}
class $AssetsImagesSparkyBumperCGen {
const $AssetsImagesSparkyBumperCGen();
AssetGenImage get active =>
const AssetGenImage('assets/images/sparky/bumper/c/active.png');
AssetGenImage get inactive =>
const AssetGenImage('assets/images/sparky/bumper/c/inactive.png');
/// File path: assets/images/sparky/bumper/c/off.png
AssetGenImage get off =>
const AssetGenImage('assets/images/sparky/bumper/c/off.png');
/// File path: assets/images/sparky/bumper/c/on.png
AssetGenImage get on =>
const AssetGenImage('assets/images/sparky/bumper/c/on.png');
}
class Assets {

Loading…
Cancel
Save