How to make the enemy follow player

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

Hi,
How I can make a 3D scene with a monster that follows the player using GDScript?
Thanks in advanced.

:bust_in_silhouette: Reply From: Surtarso

assuming you have a scene, player and enemy ready…

create a tween and interpolate property on enemy node


var player_pos = playernode.global_position
var my_pos = self.position
$tween.interpolate_property(self, "position", my_pos, player_pos, 0.5, TRANS_LINEAR, EASE_IN_OUT)
$tween.start()

I’ll try; thanks!!

Mxt08 | 2021-03-28 14:52