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

  function onStay()

    redhand1 = celeste.Mod.MaxHelpingHand.Entities.MoreCustomNPC.GetNPC("redhand1")
    redhand2 = celeste.Mod.MaxHelpingHand.Entities.MoreCustomNPC.GetNPC("redhand2")
    redhand3 = celeste.Mod.MaxHelpingHand.Entities.MoreCustomNPC.GetNPC("redhand3")
    redhand4 = celeste.Mod.MaxHelpingHand.Entities.MoreCustomNPC.GetNPC("redhand4")
    redhand5 = celeste.Mod.MaxHelpingHand.Entities.MoreCustomNPC.GetNPC("redhand5")
    redhand6 = celeste.Mod.MaxHelpingHand.Entities.MoreCustomNPC.GetNPC("redhand6")
    redhand7 = celeste.Mod.MaxHelpingHand.Entities.MoreCustomNPC.GetNPC("redhand7")
    redhand8 = celeste.Mod.MaxHelpingHand.Entities.MoreCustomNPC.GetNPC("redhand8")
    redhand9 = celeste.Mod.MaxHelpingHand.Entities.MoreCustomNPC.GetNPC("redhand9")
    redhand10 = celeste.Mod.MaxHelpingHand.Entities.MoreCustomNPC.GetNPC("redhand10")

    -- maozinha1

    if redhand1.position.X < (player.Position.X + 60) and redhand1.position.X > (player.Position.X - 60) then
      redhand1.Position = Vector2.Lerp(redhand1.Position, player.Position + vector2(0, 0), monocle.Ease.Linear(0.025))
    end

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

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

    if redhand1.position.X < (player.Position.X + 8) and redhand1.position.X > (player.Position.X - 8) and redhand1.position.Y < (player.Position.Y + 8) and redhand1.position.Y > (player.Position.Y - 11) then
      playSound("event:/game/WanderBDay/omori_redhands_teleport", player.Position)
      setFlag("teleport")
    end

    -- maozinha2

    if redhand2.position.X < (player.Position.X + 60) and redhand2.position.X > (player.Position.X - 60) then
      redhand2.Position = Vector2.Lerp(redhand2.Position, player.Position + vector2(0, 0), monocle.Ease.Linear(0.025))
    end

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

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

    if redhand2.position.X < (player.Position.X + 8) and redhand2.position.X > (player.Position.X - 8) and redhand2.position.Y < (player.Position.Y + 8) and redhand2.position.Y > (player.Position.Y - 11) then
      playSound("event:/game/WanderBDay/omori_redhands_teleport", player.Position)
      setFlag("teleport")
    end

    -- maozinha3

    if redhand3.position.X < (player.Position.X + 60) and redhand3.position.X > (player.Position.X - 60) then
      redhand3.Position = Vector2.Lerp(redhand3.Position, player.Position + vector2(0, 0), monocle.Ease.Linear(0.025))
    end

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

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

    if redhand3.position.X < (player.Position.X + 8) and redhand3.position.X > (player.Position.X - 8) and redhand3.position.Y < (player.Position.Y + 8) and redhand3.position.Y > (player.Position.Y - 11) then
      playSound("event:/game/WanderBDay/omori_redhands_teleport", player.Position)
      setFlag("teleport")
    end

    -- maozinha4

    if redhand4.position.X < (player.Position.X + 60) and redhand4.position.X > (player.Position.X - 60) then
      redhand4.Position = Vector2.Lerp(redhand4.Position, player.Position + vector2(0, 0), monocle.Ease.Linear(0.025))
    end

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

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

    if redhand4.position.X < (player.Position.X + 8) and redhand4.position.X > (player.Position.X - 8) and redhand4.position.Y < (player.Position.Y + 8) and redhand4.position.Y > (player.Position.Y - 11) then
      playSound("event:/game/WanderBDay/omori_redhands_teleport", player.Position)
      setFlag("teleport")
    end

    -- maozinha5

    if redhand5.position.X < (player.Position.X + 60) and redhand5.position.X > (player.Position.X - 60) then
      redhand5.Position = Vector2.Lerp(redhand5.Position, player.Position + vector2(0, 0), monocle.Ease.Linear(0.025))
    end

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

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

    if redhand5.position.X < (player.Position.X + 8) and redhand5.position.X > (player.Position.X - 8) and redhand5.position.Y < (player.Position.Y + 8) and redhand5.position.Y > (player.Position.Y - 11) then
      playSound("event:/game/WanderBDay/omori_redhands_teleport", player.Position)
      setFlag("teleport")
    end

    -- maozinha6

    if redhand6.position.X < (player.Position.X + 60) and redhand6.position.X > (player.Position.X - 60) then
      redhand6.Position = Vector2.Lerp(redhand6.Position, player.Position + vector2(0, 0), monocle.Ease.Linear(0.025))
    end

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

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

    if redhand6.position.X < (player.Position.X + 8) and redhand6.position.X > (player.Position.X - 8) and redhand6.position.Y < (player.Position.Y + 8) and redhand6.position.Y > (player.Position.Y - 11) then
      playSound("event:/game/WanderBDay/omori_redhands_teleport", player.Position)
      setFlag("teleport")
    end

    -- maozinha7

    if redhand7.position.X < (player.Position.X + 60) and redhand7.position.X > (player.Position.X - 60) then
      redhand7.Position = Vector2.Lerp(redhand7.Position, player.Position + vector2(0, 0), monocle.Ease.Linear(0.025))
    end

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

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

    if redhand7.position.X < (player.Position.X + 8) and redhand7.position.X > (player.Position.X - 8) and redhand7.position.Y < (player.Position.Y + 8) and redhand7.position.Y > (player.Position.Y - 11) then
      playSound("event:/game/WanderBDay/omori_redhands_teleport", player.Position)
      setFlag("teleport")
    end

    -- maozinha8

    if redhand8.position.X < (player.Position.X + 60) and redhand8.position.X > (player.Position.X - 60) then
      redhand8.Position = Vector2.Lerp(redhand8.Position, player.Position + vector2(0, 0), monocle.Ease.Linear(0.025))
    end

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

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

    if redhand8.position.X < (player.Position.X + 8) and redhand8.position.X > (player.Position.X - 8) and redhand8.position.Y < (player.Position.Y + 8) and redhand8.position.Y > (player.Position.Y - 11) then
      playSound("event:/game/WanderBDay/omori_redhands_teleport", player.Position)
      setFlag("teleport")
    end

    -- maozinha 9

    if redhand9.position.X < (player.Position.X + 60) and redhand9.position.X > (player.Position.X - 60) then
      redhand9.Position = Vector2.Lerp(redhand9.Position, player.Position + vector2(0, 0), monocle.Ease.Linear(0.025))
    end

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

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

    if redhand9.position.X < (player.Position.X + 8) and redhand9.position.X > (player.Position.X - 8) and redhand9.position.Y < (player.Position.Y + 8) and redhand9.position.Y > (player.Position.Y - 11) then
      playSound("event:/game/WanderBDay/omori_redhands_teleport", player.Position)
      setFlag("teleport")
    end

    -- maozinha10

    if redhand10.position.X < (player.Position.X + 60) and redhand10.position.X > (player.Position.X - 60) then
      redhand10.Position = Vector2.Lerp(redhand10.Position, player.Position + vector2(0, 0), monocle.Ease.Linear(0.025))
    end

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

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

    if redhand10.position.X < (player.Position.X + 8) and redhand10.position.X > (player.Position.X - 8) and redhand10.position.Y < (player.Position.Y + 8) and redhand10.position.Y > (player.Position.Y - 11) then
      playSound("event:/game/WanderBDay/omori_redhands_teleport", player.Position)
      setFlag("teleport")
    end

end