i am writing some menu code thats causes fade in/outs when going between the menus and i have ran into a small snag i usually make the easiest of mistakes to fix but never seem to spot whats under my own nose if anyone could have a look and tell me how stupid i am would be greatful.
public override float Alpha
{
get
{
return Alpha;
}
set
{
Alpha = value;
if (alpha == 1.0f)
{
increase = false;
}
else if (alpha == 0.0f)
{
increase = true;
}
}
}
thats the code and the full error message is - An unhandled exception of type 'System.StackOverflowException' occurred in Platformer.exe
Check your capitalization. You meant to write:
public override float Alpha
{
get
{
return alpha;
}
set
{
alpha = value;
// more code...
}
}
The way you wrote it, Alpha is calling itself first. Which will call itself first. Which will... you get the pattern :)