public void MakeBox() { //get colour for box int rand = randNum.Next(1, 4); int spawnrand = randNum.Next(-500, 500); Color c = Color.White; if (rand == 1) { c = Color.Red; } else if (rand == 2) { c = Color.Yellow; } else if (rand == 3) { c = Color.Orange; } //add box HerosandCars newBox = new HerosandCars(spawnrand + gap, 0, 20, c); left.Add(newBox); HerosandCars newBox2 = new HerosandCars(spawnrand + gap, 0, 20, c); right.Add(newBox2); }
/// <summary> /// Set initial game values here /// </summary> public void OnStart() { //set game start values MakeBox(); hero = new HerosandCars(this.Width / 2 - heroSize / 2, 370, heroSize); playerstart.Play(); }