| Posted By | Message | 
	
	
		|  kksonwhowho
 
   
 Registered
 05/07/2009
 Points
 719
 | 
  			5th November, 2009 at 04:33:08 - 
  		
			
		
  			
  		 Hi, I want to add grid movement for AI in some examples I found, but I don't know how. I tried to make it work, but the player and the AI overlap each other at one point or another. So, whats the best way to implement grid movement for a moving ai character so that the player doesn't overlap with the AI?
 
 Ex1. http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=153304#Post153304
 
 Ex2. http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=143885#Post143885
 
 EDIT* A good example of what I'm talking about is the 'rpg maker' for pc series movement. Like how the player can't overlap with moving events if they are on the same layer as him
 
 
  Edited by kksonwhowho 
 
  n/a | 
  	
  	
		|  kksonwhowho
 
   
 Registered
 05/07/2009
 Points
 719
 | 
  			7th November, 2009 at 16:34:34 -
  		
			
		
  			
  		 So.. no one knows how to do this?
 
 
 
  n/a | 
  	
  	
  	
  	
		|  Sketchy
 Cornwall UK
 
 Registered
 06/11/2004
 Points
 2072
 
 
      | 
  			7th November, 2009 at 18:03:35 -
  		
			
		
  			
  		 As far as I can tell, this has nothing to do with pathfinding or AI - it's just grid based movement.
 
 You just need to use a detector object. If the player presses "right" you place the detector in the square to the right of where the player is currently standing. If it overlaps another object then don't move the player. You can make the detector object act as a barrier to the AI character so that they and the player can't both move onto the same square.
 
 
  n/a | 
  	
  	
  	
  	
		|  kksonwhowho
 
   
 Registered
 05/07/2009
 Points
 719
 | 
  			7th November, 2009 at 19:21:16 -
  		
			
		
  			
  		 Ok. I tried that, but the player can still overlap with the enemy sometimes. Can anyone tell me what I'm doing wrong.
 
 Link: http://www.mediafire.com/download.php?mowg2mmzzhm
 
 
  n/a | 
  	
  	
		
			|  |  |