void BackgroundScrollComplex() { for (int i = 0; i < this.backgroundList.Count; ++i) { //Scroll each item this.backgroundList[i].ShiftXPos(scrollSpeed); //if item falls off screen, delete it and add a new one if (this.backgroundList[i].GetPos().X + this.backgroundList[i].GetImage().Width <= 0) { this.backgroundList.RemoveAt(i); BackgroundItem newItem = new BackgroundItem(basicBackground); newItem.SetPos(new Vector2(this.backgroundList[this.backgroundList.Count - 1].GetPos().X + this.backgroundList[this.backgroundList.Count - 1].GetImage().Width, newItem.GetPos().Y)); this.backgroundList.Add(newItem); } } }
public BackgroundItem(BackgroundItem backCopy) { this.image = backCopy.GetImage(); this.position = backCopy.GetPos(); }