Feature Request : get_direction4_to_entity / get_direction8_to_entity
Created by: Renkineko
It could be very useful to get the good direction to look for a NPC / enemy without redeclaring this function every time...
From the code of Agahnim, for direction4 (no need to open the file, I'm too kind... Hehe) :
function enemy:get_direction4_to_hero()
local hero = self:get_map():get_entity("hero") local angle = self:get_angle(hero) local direction4 = (angle + (math.pi / 4)) * 2 / math.pi return (math.floor(direction4) + 4) % 4 end
The second function could be optional, with the direction4 we can (I think) get easily the direction8.