I have NPC in my game and I am using gdscript ,how to code to make NPC wander around ?

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

please provide me with a simple code written in gdscript , as I am a newbie. I have also watched many videos about steering but thats not what I need i want the NPC to wander around and repel from player.I am from India please help me.

:bust_in_silhouette: Reply From: witch_milk

I would make either an animation with the animation player that moves the translation or the offset of the NPC.
Or with a script you could have the NPC choose a random direction and move to that direction every few seconds. There are many ways to do this, but it depends on what exactly you desire.

hello ,thank you for your suggestion I want NPC (which is basically the animals) in game to move in the four directions randomly ,could you be please provide me with code in gdscript language for this.

prince | 2020-11-23 15:21