namespace TestBackground{ public class HoneyDrops { public static Texture2D Texture; public static Rectangle honeyRect; int positionX = 0; int positionY = 0; int velocity; public static HoneyDrops[] honeyDrops; int numberOfDrops = 5; Texture2D dropTexture; public HoneyDrops() { honeyRect = new Rectangle(positionX, positionY, Texture.Width, Texture.Height); honeyDrops = new HoneyDrops[numberOfDrops]; } public void SetUpDrops() { float dropSpacing = 1440 / numberOfDrops; for (int i = 0; i < numberOfDrops; i++) { honeyDrops[i].dropTexture = Texture; honeyDrops[i].positionX += (int)(i * dropSpacing); honeyDrops[i].positionY = 300; } } public void Update() { for (int i = 0; i < numberOfDrops; i++) { honeyDrops[i].honeyRect.X = (int)honeyDrops[i].positionX; honeyDrops[i].honeyRect.Y = (int)honeyDrops[i].positionY; } }
{ public class HoneyDrops { public static Texture2D Texture; public static Rectangle honeyRect; int positionX = 0; int positionY = 0; int velocity; public static HoneyDrops[] honeyDrops; int numberOfDrops = 5; Texture2D dropTexture; public HoneyDrops() { honeyRect = new Rectangle(positionX, positionY, Texture.Width, Texture.Height); honeyDrops = new HoneyDrops[numberOfDrops]; } public void SetUpDrops() { float dropSpacing = 1440 / numberOfDrops; for (int i = 0; i < numberOfDrops; i++) { honeyDrops[i].dropTexture = Texture; honeyDrops[i].positionX += (int)(i * dropSpacing); honeyDrops[i].positionY = 300; } } public void Update() { for (int i = 0; i < numberOfDrops; i++) { honeyDrops[i].honeyRect.X = (int)honeyDrops[i].positionX; honeyDrops[i].honeyRect.Y = (int)honeyDrops[i].positionY; } }