Artificial Intelligence
Posted: Thu Jan 08, 2015 5:01 pm
Hello,
I want to make an artificial intelligence for a mob in my futur game
But i have some probleme for coding this
I would like the monster go from point A to point B with the shortest path.
here's what I coded :
But here is the result :
And i want this :
How I can make this ? Is it necessary to passed polar coordinated ?
Thanks for your help and sorry for my bad english
I want to make an artificial intelligence for a mob in my futur game
But i have some probleme for coding this
I would like the monster go from point A to point B with the shortest path.
here's what I coded :
- Code: Select all
if(player.x>monster.x){
monster.x+=1;
}
if(player.x<monster.x){
monster.x-=1;
}
if(player.y>monster.y){
monster.y+=1;
}
if(player.y<monster.y){
monster.y-=1;
}
But here is the result :
And i want this :
How I can make this ? Is it necessary to passed polar coordinated ?
Thanks for your help and sorry for my bad english