Difference between revisions of "A fox moves in a random direction if they haven't eaten enough food that turn"

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
Line 1: Line 1:
May as well to be honest
+
==The Fox Class==
 +
 
 +
Declare a new Boolean called MoveFox, this should be declared as private (you could make it simpler by declaring it public).
 +
 
 +
Then create a method to set this value.
 +
 
 +
Then create a method to get this value.
 +
 
 +
<syntaxhighlight lang=csharp>
 +
    private bool MoveFox = false;
 +
 
 +
    public void SetMoveFox(bool value)
 +
    {
 +
        MoveFox = value;
 +
    }
 +
 
 +
    public bool GetMoveFox()
 +
    {
 +
        return MoveFox;
 +
    }
 +
</syntaxhighlight>

Revision as of 10:46, 25 May 2017

The Fox Class

Declare a new Boolean called MoveFox, this should be declared as private (you could make it simpler by declaring it public).

Then create a method to set this value.

Then create a method to get this value.

    private bool MoveFox = false;

    public void SetMoveFox(bool value) 
    {
        MoveFox = value;
    }

    public bool GetMoveFox()
    {
        return MoveFox;
    }