A Flutter based game engine.
onRemove
/onDetach
being called for initial Gesture Detector addition (#2653). (d1721464)CameraComponent.priority
to max (#2732). (820ece1c)FilterQuality.medium
instead of high
(#2733). (fc19890c)Vector2
in globalToLocal
and localToGlobal
(#2727). (9fb3bf8d)debugCoordinatesPrecision
into a variable instead of a getter (#2713). (9918c051)onDispose
to game.dart
called from game_widget.dart
(#2659). (2f44e483)SpriteSheet
(#2754). (47722199)HasWorldReference
mixin (#2746). (9105411d)pause
and isPaused
to SpriteAnimationTicker (#2660). (37271f5c)Forge2DGame
to use CameraComponent
(#2728). (7a3d5126)ComponentKey
s to keep track of dispatchers (#2629). (ff59aa15)CameraComponent.canSee
(#2616). (1cad0b23)CollisionProspect
s and remove some list creations from the collision detection (#2625). (e430b6cd)CameraComponent
(#2615). (14f51635)mustCallSuper
from onComponentTypeCheck
(#2561). (bcae760c)Note: This release has breaking changes.
errorBuilder
and loadingBuilder
to constructors (#2526). (55ec0bc3)AnimationWidget
(#2515). (0b68be8a)stepEngine
to Game
(#2516). (1ed2c5a2)CollisionType
in hitbox constructor (#2509). (89926227)CameraComponent
and events out of experimental (#2505). (87b8a067)SpriteAnimationTicker
(#2457). (a50c80cf)In the future (maybe as early as v1.9.0) this camera will be removed, please use the CameraComponent instead.
This is the simplest way of using the CameraComponent:
Add variables for a CameraComponent and a World to your game class
final world = World();
late final CameraComponent cameraComponent;
In your onLoad
method, initialize the cameraComponent and add the world
to it.
@override
void onLoad() {
cameraComponent = CameraComponent(world: world);
addAll([cameraComponent, world]);
}
Instead of adding the root components directly to your game with add
,
add them to the world.
world.add(yourComponent);
(Optional) If you want to add a HUD component, instead of using PositionType, add the component as a child of the viewport.
cameraComponent.viewport.add(yourHudComponent);
Note: This release has breaking changes.
SpriteComponent
on sprite change (#2430). (158460d7)onLoad
(#2452). (d1ac01f5)Component.removeWhere
(#2458). (13cce4ae)HasCollisionDetection
to be on Component
(#2404). (637c258b)autoResize
for SpriteAnimationComponent
and SpriteAnimationGroupComponent
(#2453). (dbeba238)autoResize
for SpriteGroupComponent
(#2442). (1576bd83)HasTimeScale
mixin (#2431). (d2a8fe01)limit
field mutable in the Timer
class (#2358). (4e0a8c46)HasTappableComponents
mixin is no longer needed (#2450). (b5bdf4ec)If you have components that rely on receiving onGameResize calls before they load, then you can retrieve the game's size in onLoad manually via findGame()!.size.
The HasDraggableComponents mixin is now empty & deprecated. If your game used this mixin overriding its methods onDragStart, onDragUpdate, etc -- then they will no longer work. If you want to receive drag events at the top level of the game, then simply add a DragCallbacks component to the top level of the game.
The HasTappableComponents mixin is now empty & deprecated. If your game used this mixin overriding its methods onTapDown, onTapUp, etc -- then they will no longer work. If you want to receive tap events at the top level of the game, then simply add a TapCallbacks component to the top level of the game.
flame
- v1.6.0
Sprite.render
(#2261). (736733d9)canSee
method to the CameraComponent
(#2270). (2347c8f5)moveBy
to CameraComponent
(#2269). (51e54ebe)onLoad()
now returns FutureOr<void>
(#2228). (d898b539)pushReplacement
, pushReplacementNamed
, and pushReplacementOverlay
(#2249). (a2772b4e)@mustCallSuper
(#2036). (c26d5da3)RectangleComponent
(#2167). (4020d68b)@mustCallSuper
added (#2001). (45a9d79b)GameWidget
(#1725). (d1cd8517)Particles
(#2097). (59bd7ebb)Vector2.zero()
to Vector2(0, -1)
in Vector2Extensions.fromRadians()
(#2016). (801c683c)World
constructor (#2093). (3af416dc)maintainState
property to Route (#2161). (576ceaac)clampLength
for Vector2
extension (#2190). (51a896b2)removed
future + isRemoved
field for Component
(#2080). (9f322785)Note: This release has breaking changes.
REFACTOR: move broadphase-related functionality into separate subdir (#1943). (f23acd41)
REFACTOR: used simpler and more implicit widgets in GameWidget (#1862). (44d17c64)
PERF: SpriteAnimationWidget will re-render only when needed (#1876). (bb678301)
FIX: Hitbox children of a CompositeHitbox to return correct parent (#1922). (d518705e)
FIX: OpacityEffect rounding error calculation (#1933). (4cfcfa64)
FEAT: Make _ButtonState
public for SpriteButtonComponent (#1941). (e80412c5)
FEAT: Add possibility for solid hitboxes (#1919). (205ac561)
FEAT: Adding callbacks for EffectController (#1926) (#1931). (8dcdf155)
FEAT: Add lookAt method for PositionComponent (#1891). (720c3566)
FEAT: add applyLifespanToChildren to Particle generate (#1911). (884d5190)
FEAT: Add broadphase generics to CollisionDetection (#1908). (f7714122)
FEAT: Add support for isometric staggered maps (#1895). (96be8408)
FEAT: RecycledQueue now supports modification during iteration (#1884). (01b59493)
FEAT: Allow children of ComposedParticle
to have varied lifespan (#1879). (6db519ec)
FEAT: Possibility to ignore hitboxes for ray casting (#1863). (b22bc643)
DOCS: Added Style Guide and Test Writing Guide (#1897). (999caca1)
BREAKING FIX: Make all ComponentSet
modifications internal (#1877). (f26a066d)
Migration instructions:
For most methods Component has the corresponding methods directly on it already.
For example, instead of using component.children.addAll you should do component.addAll.
BREAKING CHORE: Remove functions/classes that were scheduled for removal in v1.3.0 (#1867). (00ab347c) For each deleted function/method/class, the deprecation comment already specifies what functionality should be used instead.
flame
- v1.3.0
componentsAtPoint
(#1739). (f750d705)children
argument to SpriteComponent.fromImage
(#1793). (80a63362)Ray2
class to be used in raytracing/casting (#1788). (26196c01)HasAncestor
mixin (#1711). (987a44f4)CompositeHitbox
(#1589). (78775798)SpriteBatch
APIs (#1637). (4b19a1b2)TextBoxComponent
image cache properly (#1579). (c0e3257a)ParentIsA
missing mustCallSuper
(#1604). (72129019)componentsAtPoint
now reports the "stacktrace" of points (#1615). (e2398966)HudButtonComponent
constructor and ViewportMargin
mixin to avoid code duplication (#1685). (f55b2e0d)completed
completer in SpriteAnimation
(#1564). (71999b19)isFirstFrame
and onStart
event to SpriteAnimation
(#1492). (701d0706)FpsComponent
and FpsTextComponent
(#1595). (4c68c2b0)PositionComponent
is flipped. (#1700). (cf67147e)componentsAtPoint
(#1661). (2711ba60)ParentIsA
to force parent child relations (#1566). (2cdf3868)FixedResolutionViewport
noClip -> clip (#1612). (02be4acd)onTimingsCallback
for Flutter 3.0 (#1626). (0761a79d)