public void DefiningTheMs() { var m1 = new MoveableItem(8, 1, 10); var m2 = new MoveableItem(1, 5, 10); var distanceCalc = new DistanceCalculator(); int distance = distanceCalc.distance(m1, m2); Assert.AreEqual(9, distance); }
public void ColumnCoords() { var m1 = new MoveableItem(1, 1, 10); var m2 = new MoveableItem(1, 5, 10); var distanceCalc = new DistanceCalculator(); int distance = distanceCalc.distance(m1, m2); Assert.AreEqual(4, distance); }
public void Colliding() { var m1 = new MoveableItem(1, 1, 10); var m2 = new MoveableItem(1, 1, 10); var distanceCalc = new DistanceCalculator(); int distance = distanceCalc.distance(m1, m2); Assert.AreEqual(0, distance); }
public int distance(MoveableItem m1, MoveableItem m2) { var x1 = m1._R; var y1 = m1._C; var x2 = m2._R; var y2 = m2._C; var d = (Math.Sqrt((Math.Abs(Math.Pow((x2 - x1), 2)) + (Math.Pow((y2 - y1), 2))))); return (int)Math.Ceiling(d); }
public Player(int size) { this._Item = new MoveableItem((size / 2), (size / 2), size); this.currentNumberOfCollectedItems = 0; }
public void CharacterCollision() { var m1 = new MoveableItem(1, 1, 10); var m2 = new MoveableItem(1, 1, 10); Assert.IsTrue(m1.CollidesWith(m2)); }
public Collectable(int c, int r, int size, Random rnd) { this._Item = new MoveableItem(c, r, size); this._PlayerGotTooClose = false; this.rnd = rnd; }
public Collectable(int size, Random rnd) { this._Item = new MoveableItem((size / 4) + 1, (size / 4) + 1, size); this._PlayerGotTooClose = false; this.rnd = rnd; }
public bool CollidesWith(MoveableItem other) { return this._C == other._C && this._R == other._R; }