flame_shells 0.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • new52

Flame Shells #

Beautiful and easy to use widgets that emulates console shells for your Flame game.

Right now this package bundles only a single shell, emulating classic portable consoles from early 90s, featuring a direction pad and two action buttons.

How to use #

import 'package:flame_shells/flame_shells.dart';

void main() async {
  final game = MyGame();
  final shell = FlameShell(game: game);
  runApp(shell);
}

class MyGame extends Game with HasShellControls {
  @override
  void onShellButtonTapDown(button) {
    // handle tap down
  }

  @override
  void onShellButtonTapUp(button) {
    // handle tap up
  }
}

[0.0.1] - TODO: Add release date. #

  • TODO: Describe initial release.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flame/game.dart';
import 'package:flame/flame.dart';

import 'package:flame_shells/flame_shells.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Flame.util.fullScreen();
  final game = MyGame();
  final shell = FlameShell(game: game);
  runApp(shell);
}

class MyGame extends Game with HasShellControls {
  Rect _rect = Rect.fromLTWH(10, 10, 50, 50);
  Paint _paint = Paint()..color = Color(0xFFFFFFFF);

  double _xVelocity = 0.0;
  double _yVelocity = 0.0;

  @override
  void update(double dt) {
    _rect = _rect.translate(_xVelocity * 100 * dt, _yVelocity * 100 * dt);
  }

  @override
  void render(Canvas canvas) {
    canvas.drawRect(_rect, _paint);
  }

  @override
  void onShellButtonTapDown(button) {
    if (button == FlameShellButton.DPAD_UP) {
      _yVelocity = -1;
    } else if (button == FlameShellButton.DPAD_DOWN) {
      _yVelocity = 1;
    }

    if (button == FlameShellButton.DPAD_LEFT) {
      _xVelocity = -1;
    } else if (button == FlameShellButton.DPAD_RIGHT) {
      _xVelocity = 1;
    }

    if (button == FlameShellButton.ACTION_B) {
      _paint = Paint()..color = Color(0xFF00FF00);
    }

    if (button == FlameShellButton.ACTION_A) {
      _paint = Paint()..color = Color(0xFF0000FF);
    }
  }

  @override
  void onShellButtonTapUp(button) {
    if (button == FlameShellButton.DPAD_UP ||
        button == FlameShellButton.DPAD_DOWN) {
      _yVelocity = 0;
    }

    if (button == FlameShellButton.DPAD_LEFT ||
        button == FlameShellButton.DPAD_RIGHT) {
      _xVelocity = 0;
    }

    if (button == FlameShellButton.ACTION_B ||
        button == FlameShellButton.ACTION_A) {
      _paint = Paint()..color = Color(0xFFFFFFFF);
    }
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flame_shells: ^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:flame_shells/flame_shells.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
8
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
52
Learn more about scoring.

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

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Maintenance suggestions

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.1.0 <3.0.0
flame ^0.18.1 0.18.2
flutter 0.0.0
meta ^1.1.8 1.1.8
Transitive dependencies
archive 2.0.13
args 1.6.0
audioplayers 0.14.2
box2d_flame 0.4.5
charcode 1.1.3
collection 1.14.11 1.14.12
convert 2.1.1
crypto 2.1.4
flare_dart 2.3.3
flare_flutter 2.0.1
flutter_svg 0.17.3+1
flutter_web_plugins 0.0.0
ordered_set 1.1.5
path 1.6.4
path_drawing 0.4.1
path_parsing 0.1.4
path_provider 1.6.5
path_provider_macos 0.0.4
path_provider_platform_interface 1.0.1
petitparser 3.0.1
platform 2.2.1
plugin_platform_interface 1.0.2
sky_engine 0.0.99
synchronized 2.2.0
tiled 0.2.1
typed_data 1.1.6
uuid 2.0.4
vector_math 2.0.8
xml 3.7.0
Dev dependencies
flutter_test