@Simon wrote:
Hi! Im new at monogame and im currently trying to create a random int to use in my damage. However i cant get it to work. The "r" is marked red with the error: "A field initializer cannot refrence the non static field, method, or property 'Red.r'"
Would be really glad if someone could help me
![]()
class Red : Monster
{Random r = new Random(); public int random = r.Next(0, 5); int specialattack = 5; public Red( int hp, int atk) //konstruktor för Red { healthpoints = hp; attack = atk; } public void SpecRed() //ökar reds attack med 5 { attack = attack + specialattack + random; }
Posts: 2
Participants: 2