Mark

Mark

  • NA
  • 2
  • 0

qualify it with a type name instead

Jan 21 2010 9:22 PM
Getting this error: Cannot be accessed with an instance reference, qualify it with a type name instead. Can someone tell me the code I need to get this working. I have seen other's solutions to similar problems but i'm still not getting it. The line in red letters is the problem.
 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;
}
}


Answers (2)