Your First Flutter Flame Game

Mar 6 2024 · Dart 3, Flutter 3.10.1, Android Studio 2021.3.1 or higher, Visual Studo Code 1.7.4 or higher

Part 1: Getting Started With Flame

02. Create Meteormania Game

Episode complete

Play next episode

Next
About this episode
Leave a rating/review
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 01. Learn About Flame Next episode: 03. Learn Flame's Core Concepts

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Notes: 02. Create Meteormania Game

You will need a Macintosh or Windows computer. You will need to install Flutter, and the latest version of VS Code. We recommend watching our Your First Flutter App for information on how to create a Flutter app.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

Alright, now that you’ve learned about what Flame can do, it’s time to introduce you to the game loop.

Flame dependency

First things first, open pubspec.yaml and add flame as a dependency for your project.

flame: ^1.8.2

FlameGame & GameWidget

In lib/main.dart, create a new instance of FlameGame and save it to a variable.

final game = FlameGame();
runApp(
  GameWidget(
    game: game,
  ),
);

MeteormaniaGame

Moving back to coding. In lib/meteormania_game.dart, let’s create a custom MeteormaniaGame.

import 'package:flame/game.dart';

class MeteormaniaGame extends FlameGame {
}
@override
Color backgroundColor() => const Color(0xff0b0018);
final game = MeteormaniaGame();