itch.io is community of indie game creators and players

Devlogs

Cleaning Up Add Extending Enemy Behaviour

Craftpix 2-2025
A browser game made in HTML5

Two major things in this most recent update. 

First, enemy pathing is now blocking. Enemies could previously move onto the same tile and overlap each other. This functionally has no benefit I can (currently) see, so it is now prevented. I am iterating through all the enemies in the level. They pick their next tile, based on the shortest path to the player, and block that tile. At the same time, they unblock their current tile. This way the next enemy in the array can't choose the same destination tile, but can choose a currently occupied tile that will be cleared. This allows enemies to stack up in a line, but never over top of each other.

The new behaviour does mean that if an enemy next move blocks another enemy's path to the player, it will choose to not move at all, including to where the blocking enemy is currently. Something I'll need to consider if I want to modify in the future. Shouldn't be difficult to change, but may not be relevant or worth the effort. I'll wait until I've got a proper use case for it.

The second is a bit of an edge case. 

Files

  • game.zip 8.9 MB
    2 days ago
Leave a comment