Book Image

SFML Blueprints

Book Image

SFML Blueprints

Overview of this book

Table of Contents (10 chapters)
9
Index

Building the game logic


We now have all the requirements to start our game: resource management, events management, GUI, animations, map, and the entity system. It's time for us to group them into a single project.

First, we need to create our entities. Thanks to the entity system previously described, we only need to build some components and their systems. We can build many of them, but the main components for the project are as follows:

Components

Entities

Skin

Animation

Health points

Current health

Maximum health

Team

Identifier for the team

Build area

The authorized range around the entity

Movement

Speed

Destination

Artificial intelligence for warriors

Delta time

Damage

Length of hit

The interesting ones are artificial intelligence (to damage) and movement. The others are pretty naive. Of course, you can create your own component in addition/replacement of those proposed.

Building our components

We know all the data needed by our components, so let's build the two interesting...