private void GoCell() { if (x == 1 && direction == Direction.left) { Labirint.PrintArroundDot(x, y); x = 28; } if (x == 26 && direction == Direction.right) { Labirint.PrintArroundDot(x, y); x = 1; } switch (direction) { case Direction.right: x++; break; case Direction.left: x--; break; case Direction.up: y--; break; case Direction.down: y++; break; case Direction.stop: break; } if (Labirint.MayPassToDot(x, y, newDirection)) { direction = newDirection; } else if (!Labirint.MayPassToDot(x, y, direction)) { direction = Direction.stop; } if (Labirint.GetDot(x, y) == '.') { Labirint.SetEmpty(x, y); eatedDots++; } }
public void Go() { pixelShift = timeCalculator.PixelShift(speed); mouth += mouthDirection; if (mouth > 45 || mouth < 0) { mouthDirection = -mouthDirection; } shift += pixelShift; if (shift > 19) { shift -= 20; GoCell(); } Labirint.PrintArroundDot(x, y); Draw(); MainForm.picture.Refresh(); }