ID:157592
Feb 6 2010, 7:40 pm
|
|
My game uses four directions, and I am trying to make the AI line up east, west, south, or north from the enemy. I can program well, but I wont lie, i'm not the most amazing at making things like this due to complicated problem solving. Could I get some hints of procs to use? I can handle the rest.
|
Feb 6 2010, 9:16 pm
|
|
Are you asking for the enemy to turn the direction of the player? Or to move towards the player? Or to locate itself so many X or Y places away from player but while facing the player(like oposite direction if u get what i mean).
|
dir var (atom)
Default value: SOUTH Possible values: NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST This is the direction that the object is facing. This has little effect unless the object's icon is directional. In the case of a directional icon, this selects the corresponding orientation from the icon file. An icon file with only four (cardinal) directions makes the choice of orientation ambiguous when the true direction is a diagonal. In that case, of the two possibilities, the one closest to the previous orientation is displayed. Sounds complicated, but it's what one would naturally expect. Example : verb |
In response to Darkjohn66
|
|
Okay, er
I'm asking a way so that, say the Player is one tile north, and three to the left. I want the AI to walk north one, and face left. But the problem is, complicated ones; like figuring out a path around a density, so they will be in a straight line from player, and face them. More then that, they need to be perfectly north, south, west, or east. No diagonals. Is there a pathfinding code I should know about? |
In response to Asellia
|
|
This can get rather complex quickly, but here's a simple solution to find where to go:
// Find the turf closest to us in a cardinal direction from M From there, you can just walk to it however you wish, such as using step_to(). |