Game class in Flame Flutter 2D games

As we discussed in previous posts, an application created in Flame consists of two parts, the components and a single instance of a Game class (Game class) of which we have several, although the most versatile is FlameGame.

This main class is used to create the game, these classes can be Game, BaseGame and FlameGame, which provides a complete set of tools for 2D game development as we have seen up to this point and as we will see in future installments.

Through a Game type class, we can initialize and control the entire application, from its life cycle, updates through the GameLoop, communication with other components, interacting with the user, enabling certain functionalities to the components, among others. In short, we can use the Game class in Flame to create and control the ENTIRE game, as well as add and manage all the components in various ways based on our game's business logic.

Types of classes

The BaseGame class in Flame is an abstract class that provides a set of useful tools and methods for 2D game development.

The Game class, a subclass of BaseGame, is used to implement the actual game. We can use the BaseGame class to customize and extend the functionality of the game life cycle, handle input events, use cameras, process images, keyboard input, tap among others...

- Andrés Cruz

En español
Andrés Cruz

Develop with Laravel, Django, Flask, CodeIgniter, HTML5, CSS3, MySQL, JavaScript, Vue, Android, iOS, Flutter

Andrés Cruz In Udemy

I agree to receive announcements of interest about this Blog.