pogo_tiled 0.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • new46

pogo_tiled #

Tiled plugin to the Pogo Game Engine.

The Tiled Map Editor is an awesome tool for building levels and maps. The Tiled package for Dart is used to parse Tiled's TMX files for map rendering.

Adding the plugin to your Pogo project #

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

dependencies:
  pogo_tiled: ^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_tiled/plugin.dart';

Currently, you will also need to import some objects from the tiled package to gain any significant functionality. (NOTE: This, ideally, will not be required once the plugin has been fully refactored for Pogo.) For example (not definitive):

import 'package:tiled/tiled.dart' show ObjectGroup, TmxObject;

TiledComponent class #

The TiledComponent class is a component for use in building a GameEntity. Currently, Tiled support only renders the visible layers. Other advanced features are not yet supported.

TODO: the old version of this is working but this is slated to be rebuilt; will rewrite doc after that.


See the example app.

TiledPrefab #

A prefab that implements TiledComponent.

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 #

  • TiledComponent refactor.

0.0.1 - 2020-06-17 #

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

Known issues #

  • Tried to update tiled from 0.2.1 to 0.4.0 but could not. Non-square maps generate a RangeError due to x/y-order issues in tiled 0.4.0. Furthermore, could not update anyhow because 0.4.0 relies on a newer XML library that would also force flutter_svg in Pogo to 0.18.0, which, in turn, relies on a pre-release version of Flutter, for some reason.

example/lib/main.dart

import 'package:pogo/game_engine.dart';
import 'package:pogo_tiled/plugin.dart';
import 'package:tiled/tiled.dart' show ObjectGroup, TmxObject;

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await Assets.rasterCache.load('coins.png');

  runApp(Game().widget);

  await Screen.waitForStartupSizing();

  MainEntity();
}


class MainEntity extends GameEntity {

  MainEntity() {
    final TiledComponent tiledMap = TiledComponent('map.tmx');
    TiledPrefab(tiledMap);
    _addCoinsInMap(tiledMap);
  }

  void _addCoinsInMap(TiledComponent tiledMap) async {
    final ObjectGroup obj =
        await tiledMap.getObjectGroupFromLayer("AnimatedCoins");
    if (obj == null) {
      return;
    }
    final coinAnim = AnimationComponent.fromRaster(
      Assets.rasterCache.get('coins.png'),
      frameCount: 8,
      frameWidth: 20,
      frameDuration: 0.1,
    );
    for (TmxObject obj in obj.tmxObjects) {
      AnimationPrefab(
          coinAnim,
          position: Vector2(obj.x.toDouble(), obj.y.toDouble()),
      );
    }
  }

}

Use this package as a library

1. Depend on it

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


dependencies:
  pogo_tiled: ^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_tiled/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 3, 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_tiled/plugin.dart, package:pogo_tiled/src/prefabs/tiled_prefab.dart, package:pogo_tiled/src/components/tiled_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_tiled/plugin.dart, package:pogo_tiled/src/prefabs/tiled_prefab.dart, package:pogo_tiled/src/components/tiled_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_tiled/plugin.dart, package:pogo_tiled/src/prefabs/tiled_prefab.dart, package:pogo_tiled/src/components/tiled_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_tiled/plugin.dart, package:pogo_tiled/src/prefabs/tiled_prefab.dart, package:pogo_tiled/src/components/tiled_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_tiled/plugin.dart, package:pogo_tiled/src/prefabs/tiled_prefab.dart, package:pogo_tiled/src/components/tiled_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_tiled/plugin.dart, package:pogo_tiled/src/prefabs/tiled_prefab.dart, package:pogo_tiled/src/components/tiled_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_tiled] that is in a package requiring null.

Health suggestions

Format lib/src/components/tiled_component.dart.

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

Format lib/src/prefabs/tiled_prefab.dart.

Run flutter format to format lib/src/prefabs/tiled_prefab.dart.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (tiled).

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
flutter 0.0.0
pogo ^0.2.1 0.2.2
tiled ^0.2.1 0.2.1 0.6.0
Transitive dependencies
archive 2.0.13
args 1.6.0
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
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
xdg_directories 0.1.0
xml 3.7.0 4.2.0
Dev dependencies
flutter_test
test ^1.9.4