local Vector2 = require("#microsoft.xna.framework.vector2")


function onStay()

  basil = celeste.Mod.MaxHelpingHand.Entities.MoreCustomNPC.GetNPC("basil")
  basil.Position = Vector2.Lerp(basil.Position, player.Position + vector2(0, 0), monocle.Ease.CubeInOut(0.25))

  if player.Position.X < (basil.Position.X - 5) or player.Position.X > (basil.Position.X + 5) then
    basil:PlayAnimation("walk")
  else
    basil:PlayAnimation("idle")
  end

  if player.Position.X < basil.Position.X then
    basil:SetHorizontalScale(-1)
  end

  if player.Position.X > basil.Position.X then
    basil:SetHorizontalScale(1)
  end

end