public void PlayerMove(Arrows arrow) { switch (arrow) { case Arrows.left: bomber.Image = Properties.Resources.moveleft; moving.Move(-step, 0); break; case Arrows.right: bomber.Image = Properties.Resources.moveright; moving.Move(step, 0); break; case Arrows.up: bomber.Image = Properties.Resources.bomber; moving.Move(0, -step); break; case Arrows.down: bomber.Image = Properties.Resources.bomber; moving.Move(0, step); break; default: break; } }
private void MoveEnemy(Point newPlace) { int sx = 0, sy = 0; if (enemyPlace.X < newPlace.X) { sx = newPlace.X - enemyPlace.X > step ? step : newPlace.X - enemyPlace.X; } else { sx = enemyPlace.X - newPlace.X < step ? newPlace.X - enemyPlace.X : -step; } if (enemyPlace.Y < newPlace.Y) { sy = newPlace.Y - enemyPlace.Y > step ? step : newPlace.Y - enemyPlace.Y; } else { sy = enemyPlace.Y - newPlace.Y < step ? newPlace.Y - enemyPlace.Y : -step; } moving.Move(sx, sy); enemyPlace = moving.MyNowPoint(); //При уровне сложности 2, если противник видит огонь или бомбу, то ищет новое местоположение if (level >= 2 && (map[newPlace.X, newPlace.Y] == Condition.bomb || map[newPlace.X, newPlace.Y] == Condition.fire)) { GetNewPlace(); } }