コード例 #1
0
ファイル: Snake.cs プロジェクト: toxa14147/snake_mine
 public Snake(Point tail, int lenght, Direclion _direction)
 {
     direction = _direction;
     plist     = new List <Point>();
     for (int i = 0; i < lenght; i++)
     {
         Point p = new Point(tail);
         p.Move(i, direction);
         plist.Add(p);
     }
 }
コード例 #2
0
 public void Move(int offset, Direclion direction)
 {
     if (direction == Direclion.RIGHT)
     {
         x = x + offset;
     }
     else if (direction == Direclion.LEFT)
     {
         x = x - offset;
     }
     else if (direction == Direclion.UP)
     {
         y = y + offset;
     }
     else if (direction == Direclion.DOWN)
     {
         y = y - offset;
     }
 }