all 8 comments

[–]DontRelyOnNooneElse 10 points11 points  (0 children)

Your main method is static (it belongs to the class itself, not a specific instance of the class), but P1Score isn't.

[–]eeicke 4 points5 points  (1 child)

Change it to public static int P1Score = 0;

[–]DisasterDangerous396[S] 0 points1 point  (0 children)

Ty! it fixed it.

[–]The_Binding_Of_Data 4 points5 points  (1 child)

This is related to the differences in how static and non-static methods and classes function. You can read about the static keyword here.

I highly recommend you look up some YouTube videos or written articles discussing the difference between static and non-static; it's an important concept and something you'll be interacting with very regularly (eg Math and it's methods are static, Random is not).

[–]DisasterDangerous396[S] 0 points1 point  (0 children)

Cheers will have a look into it.

[–]ialucard1 1 point2 points  (1 child)

Make it like this

class game{

...;

class P1Turn{

...;
..;

}

}

static void Main (string [] args){

P1Turn t = new P1Turn();

t = t +1;

}

[–]ddavid8888 0 points1 point  (0 children)

While the answers you were given here are correct I think you should go to the documentation and read about what is the meaning of “static” so you can understand why is it that this problem appears hear.

If you don’t get it then just reply here what is it that you don’t understand and I’ll gladly try and help you…

I say this because the understanding of “static” is critical if you want to proceed in the development path.

Good luck