int move[5][3];
if(dest.X > start.X && dest.Y > start.Y)
{
move[5][3] = {
{0,0,0},
{0,0,1}, //向东
{0,1,0}, //向南
{0,0,-1}, //向西
{0,-1,0}}; //向北
}
else if(dest.X < start.X && dest.Y > start.Y)
{
move[5][3] = {
{0,0,0},
{0,0,-1}, //向西
{0,1,0}, //向南
{0,0,1}, //向东
{0,-1,0}}; //向北
}
else if(dest.X < start.X && dest.Y < start.Y)
{
move[5][3] = {
{0,0,0},
{0,0,-1}, //向西
{0,-1,0}, //向北
{0,0,1}, //向东
{0,1,0}}; //向南
}
else(dest.X > start.X && dest.Y < start.Y)
{
move[5][3] = {
{0,0,0},
{0,0,1}, //向东
{0,-1,0}, //向北
{0,0,-1}, //向西
{0,1,0}}; //向南
} |
|