public Lane(ContentManager content, int y) { Texture2D texture = content.Load <Texture2D>("Brick"); int max = (int)Math.Ceiling((800d / texture.Width)); for (int i = 0; i < max + 1; i++) { path.Add(new ImageLabelWithItem(texture, new Vector2(texture.Width * (i - 1), y))); } First = path.First(); }
public void Update(int speed) { foreach (ImageLabelWithItem img in path) { if (img.Position.X == 800) { img.ChangePosition(new Vector2(0 - img.Texture.Width, img.Position.Y)); First = img; img.AddItem(null); FreeItemSlot?.Invoke(this, EventArgs.Empty); } else { img.ChangePosition(new Vector2(img.Position.X + speed, img.Position.Y)); } } }