コード例 #1
0
ファイル: snake.cs プロジェクト: SalihaGokceSahin/SnakeGame
 public snake()
 {
     snake_part    = new snake_parts[3];
     snake_size    = 3;
     snake_part[0] = new snake_parts(150, 150);
     snake_part[1] = new snake_parts(160, 150);
     snake_part[2] = new snake_parts(170, 150);
 }
コード例 #2
0
ファイル: snake.cs プロジェクト: SalihaGokceSahin/SnakeGame
 public void Move(direction direction)
 {
     direct = direction;
     if (direction._x == 0 && direction._y == 0)
     {
     }
     else
     {
         for (int i = snake_part.Length - 1; i > 0; i--)
         {
             snake_part[i] = new snake_parts(snake_part[i - 1].x_, snake_part[i - 1].y_);
         }
         snake_part[0] = new snake_parts(snake_part[0].x_ + direction._x, snake_part[0].y_ + direction._y);
     }
 }