pogo_box2d 0.0.1

  • Readme
  • Changelog
  • Installing
  • new46

pogo_box2d #

Box2D physics engine plugin to the Pogo Game Engine.

This currently uses Flame's Box2D fork of Google's Dart port of Java's Box2D port. box2d_flame pub.dev here.

There is a simple example game that can be used as reference of how to use Box2D on Flame (0.6.x) here. How much of this applies to Pogo as well has yet to be determined. Probably not much.

Warning #

Note that this is currently just a quick copy and error fix of how Flame was implementing Box2D. This has not been Pogo-ized yet. I haven't even tested it since Flame didn't have an example app for it.

This does not appear to be even remotely close to how I would build this, so expect major changes if I ever get around to refactoring this. The current "components" found here are really entities and not components. More likely, however, these will be dumped and replaced with a suite of true components (and maybe a mixin or something of the like).

old details: #

The whole concept of a box2d's World is mapped to the Box2DComponent component; every Body should be a BodyComponent, and added directly to the Box2DComponent, and not to the game list.

So you can have HUD and other non-physics-related components in your game list, and also as many Box2DComponents as you'd like (normally one, I guess), and then add your physical entities to your Components instance. When the Component is updated, it will use box2d physics engine to properly update every child.

Adding the plugin to your Pogo project #

Add the pogo_box2d package dependency to your project's pubspec.yaml, for example (check your version number):

dependencies:
  pogo_box2d: ^0.1.0

A plugin import is required in addition to the Pogo import in each source file that uses it:

import 'package:pogo/game_engine.dart';
import 'package:pogo_box2d/plugin.dart';

Changelog #

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

Unreleased #

  • Total refactor.
  • Example app. (Maybe the popular top-down UFO example.)

0.0.1 - 2020-06-20 #

First commit after removing the plugin from the built-in plugins of Pogo.

Known issues #

  • I doubt that this is usable as is. In need of a complete rewrite.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  pogo_box2d: ^0.0.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:pogo_box2d/plugin.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
46
Learn more about scoring.

We analyzed this package on Jul 9, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform android

Because of import path [package:pogo_box2d/plugin.dart, package:pogo_box2d/src/components/viewport.dart, package:pogo_box2d/src/components/box2d_component.dart, package:pogo/game_engine.dart, package:pogo/src/particles/sprite_particle.dart, package:pogo/src/components/sprite_component.dart, package:pogo/src/game/assets_static.dart, package:pogo/src/caches/audio_cache.dart, package:audioplayers/audio_cache.dart, package:path_provider/path_provider.dart, package:path_provider_linux/path_provider_linux.dart] that declares support for platforms: linux

Package does not support Flutter platform ios

Because of import path [package:pogo_box2d/plugin.dart, package:pogo_box2d/src/components/viewport.dart, package:pogo_box2d/src/components/box2d_component.dart, package:pogo/game_engine.dart, package:pogo/src/particles/sprite_particle.dart, package:pogo/src/components/sprite_component.dart, package:pogo/src/game/assets_static.dart, package:pogo/src/caches/audio_cache.dart, package:audioplayers/audio_cache.dart, package:path_provider/path_provider.dart, package:path_provider_linux/path_provider_linux.dart] that declares support for platforms: linux

Package does not support Flutter platform linux

Because of import path [package:pogo_box2d/plugin.dart, package:pogo_box2d/src/components/viewport.dart, package:pogo_box2d/src/components/box2d_component.dart, package:pogo/game_engine.dart, package:pogo/src/particles/sprite_particle.dart, package:pogo/src/components/sprite_component.dart, package:pogo/src/game/assets_static.dart, package:pogo/src/caches/audio_cache.dart, package:audioplayers/audio_cache.dart] that declares support for platforms: android, ios, macos, web

Package does not support Flutter platform macos

Because of import path [package:pogo_box2d/plugin.dart, package:pogo_box2d/src/components/viewport.dart, package:pogo_box2d/src/components/box2d_component.dart, package:pogo/game_engine.dart, package:pogo/src/particles/sprite_particle.dart, package:pogo/src/components/sprite_component.dart, package:pogo/src/game/assets_static.dart, package:pogo/src/caches/audio_cache.dart, package:audioplayers/audio_cache.dart, package:path_provider/path_provider.dart, package:path_provider_linux/path_provider_linux.dart] that declares support for platforms: linux

Package does not support Flutter platform web

Because of import path [package:pogo_box2d/plugin.dart, package:pogo_box2d/src/components/viewport.dart, package:pogo_box2d/src/components/box2d_component.dart, package:pogo/game_engine.dart, package:pogo/src/particles/sprite_particle.dart, package:pogo/src/components/sprite_component.dart, package:pogo/src/game/assets_static.dart, package:pogo/src/caches/audio_cache.dart, package:audioplayers/audio_cache.dart, package:path_provider/path_provider.dart] that declares support for platforms: android, ios, linux, macos

Package does not support Flutter platform windows

Because of import path [package:pogo_box2d/plugin.dart, package:pogo_box2d/src/components/viewport.dart, package:pogo_box2d/src/components/box2d_component.dart, package:pogo/game_engine.dart, package:pogo/src/particles/sprite_particle.dart, package:pogo/src/components/sprite_component.dart, package:pogo/src/game/assets_static.dart, package:pogo/src/caches/audio_cache.dart, package:audioplayers/audio_cache.dart] that declares support for platforms: android, ios, macos, web

Package not compatible with SDK dart

because of import path [pogo_box2d] that is in a package requiring null.

Health suggestions

Format lib/src/components/box2d_component.dart.

Run flutter format to format lib/src/components/box2d_component.dart.

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and pogo_box2d.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
box2d_flame ^0.4.6 0.4.6
flutter 0.0.0
pogo ^0.2.1 0.2.2
Transitive dependencies
audioplayers 0.15.1
charcode 1.1.3
collection 1.14.12 1.14.13
convert 2.1.1
crypto 2.1.5
file 5.2.1
flutter_svg 0.17.4 0.18.0
flutter_web_plugins 0.0.0
intl 0.16.1
meta 1.1.8 1.2.2
path 1.7.0
path_drawing 0.4.1
path_parsing 0.1.4
path_provider 1.6.11
path_provider_linux 0.0.1+2
path_provider_macos 0.0.4+3
path_provider_platform_interface 1.0.2
petitparser 3.0.4
platform 2.2.1
plugin_platform_interface 1.0.2
process 3.0.13
sky_engine 0.0.99
synchronized 2.2.0+1
typed_data 1.1.6 1.2.0
uuid 2.2.0
vector_math 2.0.8 2.1.0-nullsafety
xdg_directories 0.1.0
xml 3.7.0 4.2.0
Dev dependencies
flutter_test
test ^1.9.4