public void SetPositionBike(VictimBike pBike, float pX, float pY) { pBike.SetXY(pX, pY); if (_level.bikeList.Count > 0) { foreach (VictimBike otherBike in _level.bikeList) { if (pBike.HitTest(otherBike)) { SetPositionBike(pBike, pBike.CorrectLane(pX, pBike.facing), pY); } } } }
private void CreateBike() { string facing = (OurUtils.RandomBool()) ? "up" : "down"; VictimBike newBike = new VictimBike(this, facing); _victimLayer.AddChild(newBike); newBike.SetScaleXY(BIKE_SCALE, BIKE_SCALE); float positionModifier = MyGame.OldY() * ((facing == "up") ? 1 : -1); float positionX = 0; float positionY = Utils.Random(newBike.height / 2, MyGame.OldY() - newBike.height / 2) + positionModifier; positionX = newBike.CorrectLane(positionX, facing); newBike.SetPositionBike(newBike, positionX, positionY); bikeList.Add(newBike); }