Archived

This topic is now archived and is closed to further replies.

AnthonyTW

Getting all my RPG sprites moving

Recommended Posts

Your question is pretty vague.

What do you mean "design paths" for your sprites, and then draw them? Do you want your sprites to shoot out little paths that are drawn to the screen? I don''t think you do, so word your questions better

Anyway, are you talking about AI movement/pathfinding for your units? If so, you again have to be more specific. What do you want your sprite units to do? Walk around casually, like NPC''s usually do? Navigate around maps to try and find things?

In the meantime, if you''re thinking of AI, move your questions to the AI forum.


swift URL | browse my bookmarks [server may not always be on]

Sensimed | Info/download

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Here''s a way to program an NPC with a repeating path that he walks over and over:

  
#define PATH_WAIT 0
#define PATH_NORTH 1
#define PATH_SOUTH 2
#define PATH_EAST 3
#define PATH_WEST 4
#define PATH_DONE 5
//struct NPC

{
int path[32]; // up to 32 steps in his path

}
//

NPC npc;
//

npc.path[0] = PATH_NORTH;
npc.path[1] = PATH_NORTH;
npc.path[2] = PATH_WAIT;
npc.path[3] = PATH_EAST;
npc.path[4] = PATH_EAST;
npc.path[5] = PATH_SOUTH;
npc.path[6] = PATH_SOUTH;
npc.path[7] = PATH_WEST;
npc.path[8] = PATH_WEST;
npc.path[9] = PATH_DONE;

Share this post


Link to post
Share on other sites
I am going to take a stab in the dark here but I think he wants to know how to do pathfinding per unit. Then draw them, make them move till they get to the end point of the path.

So

loop
find path from a -> b for all units
draw the units to follow the path till b is reached
if b is reached do something...
end loop

But thats just a guess

Share this post


Link to post
Share on other sites