How do I rotate a Position2D node to keep pointing (or following) a node (e.g. Player)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By iamrifki

I have this Scene called Main
enter image description here

I want HoleFromHell which is a Position2D to rotate along with the Player which is an instanced scene. The Player moves in a fixed roundabout way, so it should be easy for HoleFromHell to rotate along with it (not exactly, I want it to have a slight delay), how can I do this?

(Roughly how the Player moves)

enter image description here

Main.gd

extends Node2D

export var speed = 150
export (PackedScene) var Mob

var velocity = Vector2()

var score

func _ready():
    randomize()
    
    new_game()

func _process(delta):
    pass
    
func game_over():
    $ScoreTimer.stop()
    $MobTimer.stop()

func new_game():
    score = 0
    $StartTimer.start()


func _on_MobTimer_timeout():
    var mob = Mob.instance()
    add_child(mob)
    mob.transform = $HoleFromHell.global_transform


func _on_ScoreTimer_timeout():
    score += 1


func _on_StartTimer_timeout():
    $MobTimer.start()
    $ScoreTimer.start()
:bust_in_silhouette: Reply From: iamrifki

Added

$HoleFromHell.rotation = lerp_angle($HoleFromHell.rotation, PI + $HoleFromHell.global_position.angle_to_point($Player/Ship.global_position), 0.6)

to _process()

You could also do:

$HoleFromHell.look_at($Player/Ship.global_position)

If you don’t care about adding a delay