Hey, sorry for the late response I've been busy with college.
This doesn't really seem to work. Sometimes the entity will appear on top and other times it won't. This is the code for the entity, it's purpose is to follow directly on top of the hero.
local entity = ...
local map = entity:get_map()
local hero = map:get_hero()
function entity:on_created()
local sprite = self:create_sprite("hero/swordflame")
self:set_traversable_by(true)
self:set_drawn_in_y_order(true)
local kai_movement = sol.movement.create("target")
kai_movement:set_target(hero)
kai_movement:set_speed(1000)
kai_movement:start(entity, function()
end)
end
function entity:on_update()
local x, y, layer = hero:get_position()
entity:set_position(x, y, layer)
end