This pull request refactors the Enemy::Struck() function in the Enemy.cpp file. It introduces a validation step before updating the position of the enemy. The code now checks if the calculated move is valid using the IsVaildMove() function. If the move is valid, the enemy's position is updated accordingly. This change ensures that the enemy will only move if the calculated position is valid, preventing unintended behavior.
fix #143
This pull request refactors the
Enemy::Struck()
function in theEnemy.cpp
file. It introduces a validation step before updating the position of the enemy. The code now checks if the calculated move is valid using theIsVaildMove()
function. If the move is valid, the enemy's position is updated accordingly. This change ensures that the enemy will only move if the calculated position is valid, preventing unintended behavior.