Esempio n. 1
0
        public Form1()
        {
            InitializeComponent();

            dogsArray[0] = new Greyhound()
            {
                MyPictureBox = pictureBox1, Name = "Humphrey", RacetrackLength = racetrackPictureBox.Width - racetrackPictureBox.Width, StartingPosition = racetrackPictureBox.Left, Randomizer = Randomizer
            };
            dogsArray[1] = new Greyhound()
            {
                MyPictureBox = pictureBox2, Name = "Jasper", RacetrackLength = racetrackPictureBox.Width - racetrackPictureBox.Width, StartingPosition = pictureBox1.Left, Randomizer = Randomizer
            };
            dogsArray[2] = new Greyhound()
            {
                MyPictureBox = pictureBox3, Name = "Slim", RacetrackLength = racetrackPictureBox.Width - racetrackPictureBox.Width, StartingPosition = pictureBox2.Left, Randomizer = Randomizer
            };
            dogsArray[3] = new Greyhound()
            {
                MyPictureBox = pictureBox4, Name = "Jim", RacetrackLength = racetrackPictureBox.Width - racetrackPictureBox.Width, StartingPosition = pictureBox3.Left, Randomizer = Randomizer
            };

            guyArray[0] = new Guy()
            {
                MyBet = null, Name = "Joe", Cash = 50, MyRadioButton = rbJoe, MyLabel = labelJoe
            };
            guyArray[1] = new Guy()
            {
                MyBet = null, Name = "Bob", Cash = 75, MyRadioButton = rbBob, MyLabel = labelBob
            };
            guyArray[2] = new Guy()
            {
                MyBet = null, Name = "Al", Cash = 45, MyRadioButton = rbAl, MyLabel = labelAl
            };

            guyArray[0].UpdateLabels();
            guyArray[1].UpdateLabels();
            guyArray[2].UpdateLabels();
        }
Esempio n. 2
0
        public Form1()
        {
            InitializeComponent();

            dogs[0] = new Greyhound() { MyPictureBox = this.pictureBoxDog0, RacetrackLength = pictureBoxTrack.Width - finishLineWidth - this.pictureBoxDog0.Width, StartingPosition = 25 };
            dogs[1] = new Greyhound() { MyPictureBox = this.pictureBoxDog1, RacetrackLength = pictureBoxTrack.Width - finishLineWidth - this.pictureBoxDog1.Width, StartingPosition = 25 };
            dogs[2] = new Greyhound() { MyPictureBox = this.pictureBoxDog2, RacetrackLength = pictureBoxTrack.Width - finishLineWidth - this.pictureBoxDog2.Width, StartingPosition = 25 };
            dogs[3] = new Greyhound() { MyPictureBox = this.pictureBoxDog3, RacetrackLength = pictureBoxTrack.Width - finishLineWidth - this.pictureBoxDog3.Width, StartingPosition = 25 };

            Random theRandomizer = new Random();
            for (int i = 0; i < dogs.Length; i++)
            {
                dogs[i].Randomizer = theRandomizer;
            }

            guys[0] = new Guy() { Name = "Joe", Cash = 100, MyLabel = this.labelJoeBet, MyRadioButton = this.radioButtonJoe, MyBet = null };
            guys[1] = new Guy() { Name = "Bob", Cash = 100, MyLabel = this.labelBobBet, MyRadioButton = this.radioButtonBob, MyBet = null };
            guys[2] = new Guy() { Name = "Mac", Cash = 100, MyLabel = this.labelMacBet, MyRadioButton = this.radioButtonMac, MyBet = null };

            guys[0].UpdateLabels();
            guys[1].UpdateLabels();
            guys[2].UpdateLabels();
        }
Esempio n. 3
0
        private void initializeGreyhound()
        {
            greyhoundArray = new Greyhound[4];

            greyhoundArray[0] = new Greyhound()
            {
                MyPictureBox     = greyhoundPictureBox1,
                StartingPosition = trackPictureBox.Left,
                RacetrackLength  = trackPictureBox.Width + trackPictureBox.Left - greyhoundPictureBox1.Width,
                Randomizer       = random
            };

            greyhoundArray[1] = new Greyhound()
            {
                MyPictureBox     = greyhoundPictureBox2,
                StartingPosition = trackPictureBox.Left,
                RacetrackLength  = trackPictureBox.Width + trackPictureBox.Left - greyhoundPictureBox2.Width,
                Randomizer       = random
            };

            greyhoundArray[2] = new Greyhound()
            {
                MyPictureBox     = greyhoundPictureBox3,
                StartingPosition = trackPictureBox.Left,
                RacetrackLength  = trackPictureBox.Width + trackPictureBox.Left - greyhoundPictureBox3.Width,
                Randomizer       = random
            };

            greyhoundArray[3] = new Greyhound()
            {
                MyPictureBox     = greyhoundPictureBox4,
                StartingPosition = trackPictureBox.Left,
                RacetrackLength  = trackPictureBox.Width + trackPictureBox.Left - greyhoundPictureBox4.Width,
                Randomizer       = random
            };
        }
Esempio n. 4
0
        public void AnimateGreyhound(Greyhound greyhound)
        {
            int greyhoundMove = _random.Next(Greyhound.MIN_MOVE, Greyhound.MAX_MOVE);

            greyhound.Location = new Point(greyhound.Location.X + greyhoundMove, greyhound.Location.Y);
        }
Esempio n. 5
0
        public Form1()
        {
            InitializeComponent();

            int StartPos = 20;

            Track = pictureBox1;

            guys[0] = new Guy()
            {
                Name    = "Joe",
                Cash    = 45,
                MyRadio = joeButton,
                MyLabel = joeBet,
                MyCash  = joeCash
            };

            guys[1] = new Guy()
            {
                Name    = "Bob",
                Cash    = 75,
                MyRadio = bobButton,
                MyLabel = bobBet,
                MyCash  = bobCash
            };

            guys[2] = new Guy()
            {
                Name    = "Al",
                Cash    = 55,
                MyRadio = alButton,
                MyLabel = alBet,
                MyCash  = alCash
            };

            greyhounds[0] = new Greyhound()
            {
                Id            = 1,
                StartPosition = StartPos,
                MyPicBox      = greyhoundBox1,
                Randomizer    = randomizer,
                TrackLength   = Track.Width
            };

            greyhounds[1] = new Greyhound()
            {
                Id            = 2,
                StartPosition = StartPos,
                MyPicBox      = greyhoundBox2,
                Randomizer    = randomizer,
                TrackLength   = Track.Width
            };

            greyhounds[2] = new Greyhound()
            {
                Id            = 3,
                StartPosition = StartPos,
                MyPicBox      = greyhoundBox3,
                Randomizer    = randomizer,
                TrackLength   = Track.Width
            };

            greyhounds[3] = new Greyhound()
            {
                Id            = 4,
                StartPosition = StartPos,
                MyPicBox      = greyhoundBox4,
                Randomizer    = randomizer,
                TrackLength   = Track.Width
            };

            for (int i = 0; i < guys.Length; i++)
            {
                guys[i].Update();
            }
        }