CODE
public struct Cloud
{
public float x, y;
}
public void Update()
{
cloud[i].x += 0.5f;
}
"Error 1 Cannot modify the return value of 'System.Collections.Generic.List<WindowsGame1.Game1.Cloud>.this[int]' because it is not a variable
or if you need even more:
CODE
public struct Cloud
{
public float x, y; //represents approximate center of cloud, all cloud's particles are moved around it
public List<double> xList, yList; //contains the location of every particle in the cloud. is fed a random list in the constructor
public Cloud(float x1, float y1, List<double> xList1, List<double> yList1)
{
x = x1; //center X of cloud
y = y1; // center y of cloud
xList = xList1; //location X of individual particles
yList = yList1; //location Y of individual particles
}
}
(update)
for (int cloudIndex = 0; cloudIndex < clouds.Count; cloudIndex++) //cloudIndex represents each cloud 'clump', a group of cloud particles
{
for (int particleIndex = 0; particleIndex < clouds[cloudIndex].xList.Count; particleIndex++) // particleIndex manages each individual texture of each cloud
{
clouds[cloudIndex].x += (0.5f); //add 0.5 to the X pixel location of each cloud
clouds[cloudIndex].y += (0.5f); // same for Y
if ((clouds[cloudIndex].yList[particleIndex] + clouds[cloudIndex].y) > 750) //see next line
clouds[cloudIndex] = new Cloud(-200, random.Next(-200,500), randomList(50), randomList(50)); //generates a new cloud if current one goes off screen
if ((clouds[cloudIndex].xList[particleIndex] + clouds[cloudIndex].x) > 950) // same as above
clouds[cloudIndex] = new Cloud(random.Next(-200, 700), -200 , randomList(50), randomList(50)); //same
}
}
!!!! meh, problem solved I suppose. Instead of modifying the x and y of the center of each cloud, I modified the location of each particle. It works okay i guess but I would still prefer to move entire cloud at once.
thanks for much help groovicus
if you want to see the code in action video here:
clouds are good