
Procedural Content Generation for C++ Game Development
By :

Now that we have the function that can calculate the shortest path, we need to incorporate this behavior into the game.
We now need to make the enemies follow the vector of target locations that the pathfinding algorithm generates. We need the enemy to constantly follow this path, so we'll override its base classes' Update
function, as it's called during every game's tick. The code that will do this is fairly simple; if there is a location in the vector, move towards it at a fixed pace. When the position is reached, we simply remove it from the vector. When the vector is empty, we know that the enemy has reached its goal.
We'll start by adding the function declaration to Enemy.h
:
public: /** * Overrides the default Update function in Enemy */ void Update(float timeDelta) override;
Now we can add the code to follow the path. Like we just said, if there is a value in the vector of the target positions, move towards it at a fixed...
Change the font size
Change margin width
Change background colour