Questions tagged [flame]

Flame is a modular game engine built with Flutter.

Flame is a 2D game engine built on top of the Flutter framework, composed of a ever expanding set of modular solutions that developers can pick and choose to make from simple to very complex games on Android, iOS and now web/desktop (beta).

281 questions
0
votes
1 answer

Can you animate/Tween camera.followBodyComponent

I am trying to animate, from not follow a Component, to follow a Component - and then lastly animate back again to not following the component. // this.camera.follow = Tween() this.camera.followBodyComponent(SomeComponent); Do you know how? I tried…
Chris G.
  • 23,930
  • 48
  • 177
  • 302
0
votes
2 answers

What is the purpose of "angle %= 2 * math.pi;" in the bellow code?

I am running this example from Flame engine source, and I wonder what is the purpose of angle %= 2 * math.pi; in the update method. Commenting it also doesn't affect the circular animation of rectangle! If there is a mathematical reason please put a…
Davoud
  • 2,576
  • 1
  • 32
  • 53
0
votes
0 answers

Animating specific location on an image

My question is very messed up so i need the professional help to get more information and hints. I am making a flutter app that has one page, on the middle of that page there will be an image of a building which has windows and i want to add shapes…
Jadov
  • 21
  • 6
0
votes
1 answer

Hexagon in PolygonComponent - Flame (flutter)

I am not sure how can I draw a hexagon for PolygonComponent. I found something in doc but I don't understand what should I do for hexagon. The PolygonComponent is the most complicated of the ShapeComponents since you’ll have to define all the…
0
votes
1 answer

How to get direction from onDragUpdate

How would you get a direction from onDragUpdate? Vector2 dragDeltaPosition = Vector2(0, 0); Vector2 dragDirectionVector = Vector2(0, 0); @override bool onDragStart(DragStartInfo info) { dragDeltaPosition = info.eventPosition.game -…
Chris G.
  • 23,930
  • 48
  • 177
  • 302
0
votes
1 answer

Continuous collision detection(CCD) in flame and/or forge2d

Still new to game engines and Flame. I have some tunneling/ghost collision detection using Flame. I found that you should use continuous collision detection(CCD). I don't see any CCD in Flame or forge2d, what do you do to handel tunneling?
Chris G.
  • 23,930
  • 48
  • 177
  • 302
0
votes
1 answer

PolygonShape created at different position

I'm trying to create a polygon at the center of the screen with a mouse joint, very simple. A CircleShape works great. Also the mouse joint behaves strangely and I couldn't find a pattern. All code is in the main file here. I kept the code to a…
Adam Katav
  • 328
  • 3
  • 13
0
votes
1 answer

Target of URI doesn't exist: 'package:flame/collisions.dart'

This example for collision detection has an import that is not found, do you know why? It says: Target of URI doesn't exist: 'package:flame/collisions.dart' pubspec.yaml flame: 1.0.0
Chris G.
  • 23,930
  • 48
  • 177
  • 302
0
votes
2 answers

Why is hot reload not working in Flame game engine?

I have the component below added to a FlameGame class, whenever I am changing this component I have to hot restart the app. Is there a workaround for this? class SoldierSprite extends SpriteAnimationComponent { @override Future? onLoad()…
Davoud
  • 2,576
  • 1
  • 32
  • 53
0
votes
1 answer

Flutter Flame: proper Viewport to match the screen size

How can I find out the screen size and place my game item according to screen resolution? I want to run my game on the web client. I want to resize my red game component so fit in the screen and position in center. LibGdx has some good java class…
Mneckoee
  • 2,802
  • 6
  • 23
  • 34
0
votes
2 answers

Why I get Bad state: Cannot find reference SomeGame in the component tree in Flutter Flame?

I want to reset game to its initial state and removing all the components in a method. After resetting I get this error: Bad state: Cannot find reference TurtleGame in the component tree It seems the gameRef doesn't loaded already even if I have…
Davoud
  • 2,576
  • 1
  • 32
  • 53
0
votes
1 answer

Is there a boolean method to know whether `gameEngine` is paused or not in Flutter Flame?

I would like to check if gameEngine is paused in if statement, but it seems there is no such method. if (isGameEnginePaused) { //Do something }
Davoud
  • 2,576
  • 1
  • 32
  • 53
0
votes
1 answer

FixedResolutionViewport change color of black border

In the documentation of FixedResolutionViewport of Flame, it says that the color of the black border around the viewport (when it doesn't fit into the screen) is configurable (defaulted to black). I couldn't find a way to configure this color. Is…
arun_gopalan
  • 261
  • 1
  • 7
0
votes
1 answer

How to destroy sprite objects in Flutter Flame?

Does removeFromParent destroys object? I mean Garbage collects it, I am looking for destroy method but couldn't find. update: import 'package:flame/components.dart'; class Enemy extends SpriteAnimationComponent with HasGameRef { @override …
Davoud
  • 2,576
  • 1
  • 32
  • 53
0
votes
1 answer

Why removing other sprite after collision not working in Flame?

I have two sprites in the game e.g Player and Enemy. After collision detection why remove(Component) method is not working? import 'package:flame/components.dart'; import 'package:flame/game.dart'; import 'package:flame/geometry.dart'; import…
Davoud
  • 2,576
  • 1
  • 32
  • 53