Skip to content

Commit

Permalink
feat(flame_behaviors)/add priority and key to the constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfenrain committed Jan 11, 2024
1 parent f94c0e0 commit eb127c9
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 5 deletions.
2 changes: 2 additions & 0 deletions packages/flame_behaviors/lib/src/behaviors/behavior.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ abstract class Behavior<Parent extends EntityMixin> extends Component
/// {@macro behavior}
Behavior({
super.children,
super.priority,
super.key,
});

@override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,11 @@ import 'package:flame_behaviors/flame_behaviors.dart';
/// A behavior that makes an [Entity] draggable.
/// {@endtemplate}
abstract class DraggableBehavior<Parent extends EntityMixin>
extends Behavior<Parent> with DragCallbacks {}
extends Behavior<Parent> with DragCallbacks {
/// {@macro draggable_behavior}
DraggableBehavior({
super.children,
super.priority,
super.key,
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,11 @@ import 'package:flame_behaviors/flame_behaviors.dart';
/// behaviors.
/// {@endtemplate}
abstract class HoverableBehavior<Parent extends EntityMixin>
extends Behavior<Parent> with HoverCallbacks {}
extends Behavior<Parent> with HoverCallbacks {
/// {@macro hoverable_behavior}
HoverableBehavior({
super.children,
super.priority,
super.key,
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,11 @@ import 'package:flame_behaviors/flame_behaviors.dart';
/// A behavior that makes an [Entity] tappable.
/// {@endtemplate}
abstract class TappableBehavior<Parent extends EntityMixin>
extends Behavior<Parent> with TapCallbacks {}
extends Behavior<Parent> with TapCallbacks {
/// {@macro tappable_behavior}
TappableBehavior({
super.children,
super.priority,
super.key,
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ import 'package:flutter/material.dart';
/// {@endtemplate}
abstract class CollisionBehavior<Collider extends Component,
Parent extends EntityMixin> extends Behavior<Parent> {
/// {@macro collision_behavior}
CollisionBehavior({
super.children,
super.priority,
super.key,
});

/// Check if the given component is an instance of [Collider].
bool isValid(Component c) => c is Collider;

Expand Down Expand Up @@ -65,7 +72,11 @@ abstract class CollisionBehavior<Collider extends Component,
class PropagatingCollisionBehavior<Parent extends EntityMixin>
extends Behavior<Parent> with CollisionCallbacks {
/// {@macro propagating_collision_behavior}
PropagatingCollisionBehavior(this._hitbox) : super(children: [_hitbox]);
PropagatingCollisionBehavior(
this._hitbox, {
super.priority,
super.key,
}) : super(children: [_hitbox]);

final ShapeHitbox _hitbox;

Expand Down
6 changes: 5 additions & 1 deletion packages/flame_steering_behaviors/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
name: flame_steering_behaviors
description: Flame Steering Behaviors brings steering algorithms to the behavior pattern, built by Very Good Ventures.
version: 0.1.0
homepage: https://github.com/VeryGoodOpenSource/flame_behaviors
repository: https://github.com/VeryGoodOpenSource/flame_behaviors
issue_tracker: https://github.com/VeryGoodOpenSource/flame_behaviors/issues
documentation: https://github.com/VeryGoodOpenSource/flame_behaviors/tree/main/docs

environment:
sdk: ">=2.17.0 <3.0.0"
sdk: ">=3.0.0 <4.0.0"

dependencies:
flame: ">=1.10.0 <2.0.0"
Expand Down

0 comments on commit eb127c9

Please sign in to comment.