Difference between revisions of "Implementing weather changes that affect animals"

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
Line 16: Line 16:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 +
Winter Effects
 
<syntaxhighlight lang="csharp">  
 
<syntaxhighlight lang="csharp">  
  

Revision as of 12:18, 14 March 2017

 
                if (menuOption == 1)
                {
                    TimePeriod++;
                    Season = TimePeriod % 4;
                    ShowDetail = true;
                    AdvanceTimePeriod();
                }
                if (menuOption == 2)
                {
                    TimePeriod++;
                    Season = TimePeriod % 4;
                    ShowDetail = false;
                    AdvanceTimePeriod();
                }

Winter Effects

 

        private double DistanceBetween(int x1, int y1, int x2, int y2)
        {
            if (Season==0)
            {
                return (Math.Sqrt(Math.Pow(x1 - x2, 2) + Math.Pow(y1 - y2, 2))+3);
            }
            else
            return Math.Sqrt(Math.Pow(x1 - x2, 2) + Math.Pow(y1 - y2, 2));
        }