flame_behaviors 1.1.0 flame_behaviors: ^1.1.0 copied to clipboard
Flame Behaviors applies separation of concerns to game logic in the form of Entities and Behaviors, built by Very Good Ventures.
import 'package:example/behaviors/behaviors.dart';
import 'package:flame/components.dart';
import 'package:flame/game.dart';
import 'package:flame_behaviors/flame_behaviors.dart';
import 'package:flutter/material.dart';
class ExampleGame extends FlameGame with EntityMixin, HasCollisionDetection {
@override
Future<void> onLoad() async {
await add(FpsTextComponent(position: Vector2.zero()));
await add(ScreenHitbox());
// Game-specific behaviors
await add(SpawningBehavior());
return super.onLoad();
}
}
void main() {
runApp(GameWidget(game: ExampleGame()));
}