Example #1
0
 public static void translate(ref int x, ref int y, Direction direction)
 {
     if (direction.isUp())
     {
         y--;
     }
     else if (direction.isRight())
     {
         x++;
     }
     else if (direction.isDown())
     {
         y++;
     }
     else if (direction.isLeft())
     {
         x--;
     }
 }
Example #2
0
 // teste si un sprite peut se déplacer dans une direction
 internal UInt16 getWallAt(int fromX, int fromY, Direction direction)
 {
     UInt16 wall;
     translate(ref fromX, ref fromY, direction);
     if (outBound(fromX, fromY))
     {
         wall = 0;
     }
     else
     {
         wall = get(fromX, fromY);
     }
     return wall;
 }
Example #3
0
 public bool isOpposite(Direction other)
 {
     return Math.Abs(_Direction - other._Direction) == 2;
 }