Guest User

GreyHound.cs

a guest
Jun 15th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.96 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows.Forms;
  7.  
  8.  
  9. namespace BetDogsHeadFirst
  10. {
  11.     public class GreyHound
  12.     {
  13.         public int startPosition;
  14.         public int raceTrackLength;
  15.         public PictureBox dogPictureBox;
  16.         public int location = 0;
  17.         public Random randomizer;
  18.  
  19.         public bool Run()
  20.         {
  21.             Random randomizer = new Random();
  22.             int distance = randomizer.Next(1,5);
  23.             dogPictureBox.Left = dogPictureBox.Left + distance;
  24.             location += distance;
  25.             if (location >= (raceTrackLength - startPosition))
  26.                 return true;
  27.             else
  28.                 return false;
  29.  
  30.  
  31.  
  32.  
  33.         }
  34.         public void TakeStartingPosition()
  35.         {
  36.  
  37.             dogPictureBox.Left = dogPictureBox.Left - location;
  38.             location = 0;
  39.            
  40.         }
  41.     }
  42. }
Add Comment
Please, Sign In to add comment