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; } } |
Sam HobbsPosted Jan 26, 2010, 12:03 PM
Sam HobbsPosted Jan 22, 2010, 3:20 PM
In the future, please invest the time to reduce the code you post to the minimum necessary to create the problem. Yes, it is more work for you, but it is then less work for the person trying to help you. It is what I would do if I were to ask a question, and many times I solve the problem myself when I create a small sample of a problem I am having. And don't just copy and paste code; be sure that the sample code is accurate and does in fact have the problem.