protected override void LaneInit() { // **note: don't call base, this is two lanes laneCount = 4; int laneTop = 120; int laneHeight = 240; if (lanes == null) { lanes = new Lane[laneCount]; } lanes[0] = new Lane(0, laneTop, LaneKind.Empty); for (int i = 1; i < lanes.Length; i++) { lanes[i] = new Lane(i, laneHeight, LaneKind.WideCar); lanes[i].vehicleSpeed = 10;// rnd.Next(8, 15); lanes[i].minCreationDelay = (int)(10000 / lanes[i].vehicleSpeed); lanes[i].maxCreationDelay = 6000; lanes[i].movesRight = i >= lanes.Length / 2; lanes[i].yLocation = laneTop + lanes[i].laneHeight * (i - 1); } lanes[lanes.Length - 1].LaneKind = LaneKind.Empty; lanes[lanes.Length - 1].laneHeight = 120; }
public void Reset(float x, float y, float rot) { this.roundScore = 0; this.lane = null; this.playerSkin = PlayerSkin.None; this.isExploding = false; this.skipDeathMarker = false; this.autoCenterOnLane = true; this.dampingRatio = .7f; this.impulseScale = 50f; this.X = x; this.Y = y; this.Rotation = rot; this.SpeedLevel = SpeedLevel.Normal; lastStepPos = body.GetPosition(); goalIsTop = !(lastStepPos.Y < this.screen.ClientSize.Y / 2); this.SpeedLevel = SpeedLevel.Normal; aboardVehicle = null; this.LivingState = LivingState.Alive; }
protected virtual void LaneInit() { // default impl, don't call base if you don't want 8 lanes of traffic like this laneCount = 10; if (lanes == null) { lanes = new Lane[laneCount]; } int[] speeds = new int[] { 5, 15, 20, 30, 40, 40, 30, 20, 15, 5 }; lanes[0] = new Lane(0, 67, LaneKind.Sidewalk); lanes[0].vehicleSpeed = speeds[0]; lanes[0].minCreationDelay = 15000; lanes[0].maxCreationDelay = 25000; lanes[0].movesRight = false; lanes[0].yLocation = 27; for (int i = 1; i < lanes.Length; i++) { lanes[i] = new Lane(i, 67, LaneKind.Car); lanes[i].vehicleSpeed = speeds[i] + rnd.Next(10); lanes[i].minCreationDelay = (int)(60000 / lanes[i].vehicleSpeed); lanes[i].maxCreationDelay = 6000; lanes[i].movesRight = i >= lanes.Length / 2; lanes[i].yLocation = 88 + lanes[i].laneHeight * (i - 1); } lanes[lanes.Length - 1].LaneKind = LaneKind.Sidewalk; lanes[lanes.Length - 1].vehicleSpeed = speeds[lanes.Length - 1]; lanes[lanes.Length - 1].minCreationDelay = 15000; lanes[lanes.Length - 1].maxCreationDelay = 25000; }