public void NewPiece() { SnakePiece newpiece = new SnakePiece(Brushes.Gray, Body[Body.Count - 1].x, Body[Body.Count - 1].y, Body[Body.Count - 1].direction, Head.length); if (Body[Body.Count - 1].direction == 0) { newpiece.y += Head.length; } if (Body[Body.Count - 1].direction == 1) { newpiece.y -= Head.length; } if (Body[Body.Count - 1].direction == 2) { newpiece.x += Head.length; } if (Body[Body.Count - 1].direction == 3) { newpiece.x -= Head.length; } Body.Add(newpiece); }
public FullSnake(Brush color, int x, int y, int direction, int length) { SnakePiece snakePiece = new SnakePiece(color, x, y, direction, length); Body.Add(snakePiece); }