Original Post
I have a list variable of a structure type, and I want to change the value of a variable inside the structure of a part of the list at position 'index'. But I keep getting a compiler error: I've looked at the error help and did what they suggested but it did not work ,then I tried referencing the SpriteEffect in the array's structure but that just got me even more errors, I'm new to C# because I want to try the XNA Game Studio.
Quote:Heres my code:
Error 1 Cannot modify the return value of 'System.Collections.Generic.List .this[int]' because it is not a variable C:\Documents and Settings\Zmurf\My Documents\Visual Studio 2005\Projects\MarioGame\MarioGame\Sprites.cs 57 9 MarioGame
protected struct SpriteProperties
{
public Texture2D m_sTexture;
public int m_sHeight, m_sWidth, m_sX, m_sY;
public int m_sFrames;
public SpriteEffects m_sEffects;
public SpriteBlendMode m_sBlendMode;
public SpriteProperties(Texture2D texture,
int width, int height, int x, int y, int frames,
SpriteEffects effects, SpriteBlendMode blendmode)
{
m_sTexture = texture;
m_sWidth = width;
m_sHeight = height;
m_sX = x;
m_sY = y;
m_sFrames = frames;
m_sEffects = effects;
m_sBlendMode = blendmode;
}
};
List<SpriteProperties> m_Sprites;
public void SpriteEffect(int index, SpriteEffects effect)
{
m_Sprites[index].m_sEffects = effect;
}