© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2024
A. Cruz YorisFlame Game Developmenthttps://doi.org/10.1007/979-8-8688-0063-4_10

10. Game 3: Enemies

Andrés Cruz Yoris1  
(1)
Caracas, Venezuela
 

In this chapter, we are going to incorporate some enemies on the map. For this, they will have a mobility like that of the player; therefore, we will use the Character class as a base.

We are going to define the following class, where we will incorporate the necessary functionalities for the different enemies that we are going to need. For now, it will be a class with which the enemy will change movement randomly:
lib/components/eneminy_character.dart
import 'dart:math';
import 'package:worldxy04/components/character.dart'; ...

Get Flame Game Development: Your Guide to Creating Cross-Platform Games in 2D Using Flame Engine in Flutter 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.