This code checks if the `objects` variable is not nil....
This code checks if the objects
variable is not nil. If it is not nil, it iterates over each element in the objects
array using a for loop.
Inside the loop, it assigns the current element to the obj
variable. It then checks if obj
is not nil, not equal to self.character
, and either an instance of the IsoZombie
or IsoPlayer
class. If these conditions are met, it further checks if obj
is not dead, has a valid square, and the square's Z coordinate is less than or equal to self.character
's square's Z coordinate.
If all these conditions are met, it calculates the distance between self.character
and obj
using NPCUtils.getDistanceBetween
. If obj
is on the floor, it adds 1 to the distance.
The purpose of this code is to filter and prioritize certain objects based on specific conditions.