Java: setting a objects variable in outside function
<pre><code>    public static void main(String[] args) {

        Player Anfallare = new Player("A");
        Player Forsvarare = new Player("F");
        MotVarandra(Anfallare.getDice(1), Forsvarare.getDice(1));
    (...)
   }
</code></pre>

<p>Is what I have in main function, now I made a own function, </p>

<pre><code>public static void MotVarandra(int a, int f){
    if(f &gt;= a){
        Anfallare.armees-=1;
    }else{
        Forsvarare.armees-=1;
    }
}
</code></pre>

<p>which should set the object's variable to -=1.. But this doesn't work because the function doesnt know that Anfallare and Forsvarare is an object..</p>

<p>What can i do in this case?</p>
