krazyjakee/mystalia-ecsy

Enemy sometimes cannot be attacked while moving.

Closed this issue · 0 comments

This is because the range from player to enemy is calculated from the currentTile on the server which is a random tile within a distance of the previous one.

This is tricky. Essentially the server needs to calculate the tile that the enemy is currently on (using pathfinding). That way we can correctly calculate how far the player is from the enemy and fix the distance. https://github.com/krazyjakee/mystalia-ecsy/blob/master/src/server/workers/battle.ts#L77