Example #1
0
        // teste si un sprite peut se déplacer dans une direction
        internal byte getWallAt(int fromX, int fromY, Direction direction)
        {
            byte wall;

            if (direction.isUp())
            {
                fromY--;
            }
            else if (direction.isRight())
            {
                fromX++;
            }
            else if (direction.isDown())
            {
                fromY++;
            }
            else if (direction.isLeft())
            {
                fromX--;
            }
            if (fromX < 0 || fromX >= WIDTH || fromY < 0 || fromY > HEIGHT)
            {
                wall = 0;
            }
            else
            {
                wall = get(fromX, fromY);
            }
            return(wall);
        }
Example #2
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 #3
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--;
     }
 }