itch.io is community of indie game creators and players

Devlogs

EnemyManager #2

Eternal Light
A downloadable Deus Devlog

Steps to perfection

Today I focused on establishing a small idle walk pattern for the enemy.

To respect the set architecture, the pure management of the movement has been entrusted to the EnemyManager which takes the necessary data from the Enemy (e.g. speed and direction).

After having set everything up correctly, I asked myself: what path should the enemy take? Forward and backward, clockwise, etc. The more I thought about it, the less I liked the idea of ​​a fixed route, so I opted for a random route, where at each step a direction is chosen.

I work hard, write the code for randomization but I run into an annoying problem… sometimes the enemy gets stuck in one direction and continues to stay there! This is because the algorithm chooses randomly and could return out the same previous direction… not good at all.

So I perfected this pattern by making sure that if the enemy found an obstacle he would not repeat the same direction.

To keep things streamlined I simply memorized the last direction chosen by the EnemyManager and discarded it from the possible subsequent ones.

In the screen you can see part of the movement algorithm, it works well though it’s not perfect.

Now.. what to do next? Do I focus on refining the code architecture more or implement a new manager?

Stay tuned!

Leave a comment