private void MoveMob(Point newPlace) { int sx = 0; int sy = 0; if (mobPlace.X < newPlace.X) { sx = newPlace.X - mobPlace.X > step ? step : newPlace.X - mobPlace.X; } else { sx = mobPlace.X - newPlace.X < step ? newPlace.X - mobPlace.X: -step; } if (mobPlace.Y < newPlace.Y) { sy = newPlace.Y - mobPlace.Y > step ? step : newPlace.Y - mobPlace.Y; } else { sy = newPlace.Y - mobPlace.Y < step ? newPlace.Y - mobPlace.Y : -step; } moving.Move(sx, sy); mobPlace = moving.MyCurrentPossition(); if (level >= 2 && map[newPlace.X, newPlace.Y] == Sost.бомба || map[newPlace.X, newPlace.Y] == Sost.огонь) { GetNewPlace(); } }
public Mob(PictureBox picMob, PictureBox[,] _mapPic, Sost[,] _map, Player _player) { mob = picMob; map = _map; player = _player; fmap = new int[map.GetLength(0), map.GetLength(1)]; path = new Point[map.GetLength(0) * map.GetLength(1)]; moving = new MovingClass(picMob, _mapPic, _map, addBonus); mobPlace = moving.MyCurrentPossition(); destinPlace = mobPlace; CreateTimer(); timer.Enabled = true; }
public Point MycurrentPossion() { return(moving.MyCurrentPossition()); }