Project code
Sorry with this method, the enemy world position wasn’t calculated correctly.
Updated code:
// => methods
void Enemy::changeMovingDirection(Vector2 &direction)
{
direction = Vector2Subtract(
m_target->getWorldPosition(),
m_worldPosition);
}
void Enemy::updateScreenPosition()
{
m_screenPosition = Vector2Add(
Vector2Subtract(
m_worldPosition,
m_target->getWorldPosition()),
m_target->getScreenPosition());
}
tick()
is in BaseCharacter.cpp