Conceptiual AI Movement

Started by
-1 comments, last by xxCYBxx 23 years, 4 months ago
What you could do is use a graph, i don''t know if your game has an enviorment similar, but a graph would work. Aswell, i''ve seen how the ghost''s react, it''s like a five space distance the''ll ignore you. Give all the spaces 4 bool variables, North, South, East, West and the distance vairable(i.e.)

class block_of_graph { //.......other.block.code......// bool bOpen[4]; // [0]-north, [1]-east, [2]-south, [3]-west // ''True'' = it''s an empty space, ''False'' = can''t move to it. //.......other.block.code......// } you must also keep up the distance between the player and the current ghost. int Distance; //Must keep this updated acording to how the player moves and all. //(--Distance=abs((current_ghost_pos.x - current_player+pos.x) - (current_ghost_pos.y - current_player+pos.y))--) And the routine would look like Ghost_Move() { if(Distance>5) { /* Move to One Random Open Space */ } else { /* Find the Space with the Shorter Distance from the Player */ /* Move There */ } } Somewhat...

This topic is closed to new replies.

Advertisement