NTUT-FUCK-PTSD / Fuck-PTSD

This is a repo about rewriting the game `crypt of the necrodancer` in OOP Lab
MIT License
2 stars 2 forks source link

Refactor Enemy::Struck method and improve knockback logic #145

Closed HeavenManySugar closed 3 months ago

HeavenManySugar commented 3 months ago

fix #143

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.