PR suggestions

pull/35/head
Erick Zanardo 4 years ago
parent 16b928927d
commit ac34bf356c

@ -4,19 +4,15 @@ import 'dart:async';
import 'package:flame/input.dart'; import 'package:flame/input.dart';
import 'package:flame_bloc/flame_bloc.dart'; import 'package:flame_bloc/flame_bloc.dart';
import 'package:flame_forge2d/flame_forge2d.dart'; import 'package:flame_forge2d/flame_forge2d.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:pinball/game/game.dart'; import 'package:pinball/game/game.dart';
import 'package:pinball_theme/pinball_theme.dart'; import 'package:pinball_theme/pinball_theme.dart';
class PinballGame extends Forge2DGame class PinballGame extends Forge2DGame
with FlameBloc, HasKeyboardHandlerComponents, TapDetector { with FlameBloc, HasKeyboardHandlerComponents {
PinballGame({required this.theme, bool isDebugMode = kDebugMode}) : _isDebugMode = isDebugMode; PinballGame({required this.theme});
final PinballTheme theme; final PinballTheme theme;
final bool _isDebugMode;
// TODO(erickzanardo): Change to the plumber position // TODO(erickzanardo): Change to the plumber position
late final ballStartingPosition = screenToWorld( late final ballStartingPosition = screenToWorld(
Vector2( Vector2(
@ -108,12 +104,15 @@ class PinballGame extends Forge2DGame
), ),
); );
} }
}
class DebugPinballGame extends PinballGame with TapDetector {
DebugPinballGame({ required PinballTheme theme}) : super(theme: theme);
@override @override
void onTapUp(TapUpInfo info) { void onTapUp(TapUpInfo info) {
if (_isDebugMode) { add(Ball(position: info.eventPosition.game));
add(Ball(position: info.eventPosition.game));
}
} }
} }

Loading…
Cancel
Save