flame-engine / flame_forge2d Goto Github PK
View Code? Open in Web Editor NEWPackage to add box2d support for the Flame game engine
License: MIT License
Package to add box2d support for the Flame game engine
License: MIT License
A lot of error occur when I download and run it.
lib/draggable_sample.dart:40:26: Error: Type 'DragEvent' not found.
bool handleReceiveDrag(DragEvent event) {
^^^^^^^^^
lib/draggable_sample.dart:50:22: Error: Type 'DragEvent' not found.
bool onReceiveDrag(DragEvent event) {
^^^^^^^^^
lib/mouse_joint_sample.dart:38:22: Error: Type 'DragEvent' not found.
void onReceiveDrag(DragEvent drag) {
^^^^^^^^^
../lib/forge2d_game.dart:10:1: Error: 'Viewport' is imported from both 'package:flame/src/game/viewport.dart' and 'package:flame_forge2d/viewport.dart'.
import 'viewport.dart';
^^^^^^^^
lib/position_body_sample.dart:59:33: Error: The parameter 'details' of the method 'PositionBodySample.onTapDown' has type 'TapDownDetails', which does not match the corresponding type, 'TapDownInfo', in the overridden method, 'Forge2DGame with
TapDetector.onTapDown'.
- 'TapDownDetails' is from 'package:flutter/src/gestures/tap.dart' ('../../../flutter/packages/flutter/lib/src/gestures/tap.dart').
- 'TapDownInfo' is from 'package:flame/src/gestures/events.dart' ('../../../flutter/.pub-cache/hosted/pub.dartlang.org/flame-1.0.0-releasecandidate.11/lib/src/gestures/events.dart').
Change to a supertype of 'TapDownInfo', or, for a covariant parameter, a subtype.
void onTapDown(TapDownDetails details) {
When this mapping is not done properly Box2d behaves in unexpected ways, but dealing with both coordinate systems in multiple places is confusing. I suggest a single place in flame_forge2d where the caller can define the value of pixels-per-meter
. Perhaps as an optional parameter to the Forge2dGame constructor. Flame users can continue to deal with existing flame apis in pixels, and flame_forge2d can do all the conversions for us.
https://flame-engine.org/docs/forge2d.md points to a non-existent page. Where can I find the documentation for Forge2D?
I couldn't run the example. It has some compile time errors. Please fix.
I'm using flutter 2.0.1 & dart 2.12.0
debugMode
in the BodyComponent
always is true . It does not changed with the debugMode
which in the Forge2DGame
.
The latest version 0.6.4-rc4 is not compatible with the latest flame 1.0.0-rc8. Getting the following error,
Error: 'Viewport' is imported from both 'package:flame/src/game/viewport.dart' and 'package:flame_forge2d/viewport.dart'.
import 'viewport.dart';
Error: Method not found: 'SpriteComponent.fromSprite'.
) : super(SpriteComponent.fromSprite(spriteSize, sprite), spriteSize);
Build 0.7.2--releasecandidate.12 of the flame_forge package throws an UnimplementedError from the abstract class BodyComponent. This bug was introduced in the "Update to rc 12" commit 4058eaca79ba1b648120bcfe839624e9aa5f0110
. The bug is in line 58 of body_component.dart:
if (_transform.m14 != body.position.x ||
_transform.m24 != body.position.y ||
_lastAngle != angle) {
_transform.setIdentity();
_transform.scale(1, -1); // <- THIS IS THE BUG CAUSING THE UNIMPLEMENTEDERROR
_transform.translate2(body.position);
_transform.rotateZ(angle);
_lastAngle = angle;
}
The UnimplementedError is being thrown because the Matrix4 scale method doesn't support integer values for the x parameter. The method signature is:
void scale(dynamic x, [double? y, double? z])
The x parameter must be a Vector3, Vector4, or a double otherwise, an UnimplementedError is thrown.
I ran circle_stress_sample.dart from the spydon.update-versions branch.
I deleted the left side of the two CornerRamps, and the right side shows up, but the hit decision is on the left side.
Future<void> onLoad() async {
final boundaries = createBoundaries(viewport);
boundaries.forEach(add);
add(CircleShuffler());
add(CornerRamp(isMirrored: true));
// add(CornerRamp(isMirrored: false));
}
Just like the headline says; the examples need to be moved here from the main flame repo and they also need some updating to fit the refactoring.
Right now, it doesn't seem flame_forge2d has been published to pub.dev. Should I simply clone this repo into my project and reference via relative path in pubspec.yaml? Something like
dependencies:
flutter:
sdk: flutter
flame_forge2d:
path: flame_forge2d
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.