I'm currently working on a game in c#, but a problem has occurred that has had me stuck. The issue is, that I can't figure out how I can get the assigned value of the string 'sprite' printed out. The game I'm working on will have multiple values assigned to the sprite string, which is the reason why I'm not just assigning a value to the string when it's declared.
For the sake of simplicity, I've reduced the scenario into a more simple example.
class Program
{
static void Main(string[] args)
{
Player p;
p = new Player();
Console.Read();
}
}
class GameObject
{
public GameObject(string spriteName)
{
Console.WriteLine(spriteName);
}
}
class Player : GameObject
{
public static string sprite;
public Player() : base(sprite)
{
sprite = "Test";
}
}
}