Godot Version
4.5
Question
Hi, I'm trying to make a top down 2D game like one of the old Legend of Zelda game and I was wondering how I could make the enemies wander around the level?
4.5
Hi, I'm trying to make a top down 2D game like one of the old Legend of Zelda game and I was wondering how I could make the enemies wander around the level?
I was thinking of getting the enemy to get the positions of traversable tiles within a certain radius of it and pathfind to one of them. Would that be a good idea?
Yes that would work. You may also want a root position for an enemy so that it does not wander too far from its starting position.
And depending on how big your game world is, and how many NPC’s you have, and when you generate enemies, you may also want a way to activate enemies in a certain sector or at a certain distance from the player. So enemies nowhere near you or your viewport aren’t taking up processing time needlessly. However you might not need to bother with this if you only have a few NPCs, or they are always needed, like for a minimap.
What would be a good way to get the tile positions of the tiles? I was thinking of using an Area 2D or a Shape Cast. What would you suggest?
Haven’t you asked this two times already?
Yeah your right. I’m sorry to bother you I just had a hard time getting my head around it. I think I have it figured out now.
The Area 2D Hasn’t really worked out for me so think I’m going to scan for surrounding tiles based on the enemies global position instead.
Thank you for the help!
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.