Closed R1DEL closed 2 months ago
Added boundary checks in LineOfSight function:
LineOfSight
x0
y0
d.CollisionGrid
Adjusted index calculation in ensureEnemyIsInRange method:
ensureEnemyIsInRange
moveTo
path
Thanks for the contribution, will wait for @hectorgimenez to double-check :)
Fix index out of range error in LineOfSight and ensureEnemyIsInRange
Changes:
Added boundary checks in
LineOfSight
function:x0
andy0
are within the valid range of thed.CollisionGrid
array to prevent out-of-bounds errors.Adjusted index calculation in
ensureEnemyIsInRange
method:moveTo
to ensure it does not exceed the bounds of thepath
array.Testing: