コード例 #1
0
ファイル: Form1.cs プロジェクト: ivanaltan/Frog-Pond
        void StartGame(int t)
        {
            btnPause.Enabled = true;
            playing          = true;
            time             = t;

            seconds = 2;

            flies = new FliesCollection();

            player1 = new Player1(flies);

            if (players > 1)
            {
                player2 = new Player2(flies);
            }
            if (players == 3)
            {
                player3 = new Player3(flies);
            }

            secondtimer          = new Timer();
            secondtimer.Interval = 1000;

            gametimer          = new Timer();
            gametimer.Interval = time * 1000;

            frametimer          = new Timer();
            frametimer.Interval = 16;

            flyspawntimer = new Timer();
            if (players == 1)
            {
                flyspawntimer.Interval = Adjustments.FlySpawnIntervalSingle;
            }
            else
            {
                flyspawntimer.Interval = Adjustments.FlySpawnIntervalMulti;
            }

            gametimer.Tick     += new EventHandler(gametimer_Tick);
            frametimer.Tick    += new EventHandler(frametimer_Tick);
            flyspawntimer.Tick += new EventHandler(flyspawn_Tick);
            secondtimer.Tick   += new EventHandler(secondtimer_Tick);

            gametimer.Enabled     = true;
            frametimer.Enabled    = true;
            flyspawntimer.Enabled = true;
            secondtimer.Enabled   = true;

            flies.AddFly();

            ActiveControl = groupBox1;
        }
コード例 #2
0
        public Frog(FliesCollection flies)
        {
            this.flies  = flies;
            points      = 0;
            tonguestate = 0;
            powerup     = false;
            moving      = false;
            jumping     = false;

            img         = 0;
            text        = new FrogText();
            tongue      = new List <Circle>();
            tonguedelay = 0;
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: ivanaltan/Frog-Pond
 private void EndGame()
 {
     frametimer.Dispose();
     flyspawntimer.Dispose();
     secondtimer.Dispose();
     btnPause.Enabled = false;
     playing          = false;
     gametimer.Dispose();
     Invalidate(true);
     flies        = null;
     lblTime.Text = "0";
     lblP1.Text   = "0";
     lblP2.Text   = "0";
     lblP3.Text   = "0";
 }
コード例 #4
0
        public Player1(FliesCollection flies) : base(flies)
        {
            position  = new Point(150, Adjustments.Ground);
            id        = 1;
            direction = true;
            img1      = Properties.Resources.frog1_1;
            img2      = Properties.Resources.frog1_2;
            imgjump   = Properties.Resources.frog1_jump;
            img1F     = Properties.Resources.frog1_1;
            img1F.RotateFlip(RotateFlipType.RotateNoneFlipX);
            img2F = Properties.Resources.frog1_2;
            img2F.RotateFlip(RotateFlipType.RotateNoneFlipX);
            imgjumpF = Properties.Resources.frog1_jump;
            imgjumpF.RotateFlip(RotateFlipType.RotateNoneFlipX);

            tongue.Add(new Circle(new Point(position.X + Adjustments.TongueOffsetX, position.Y + Adjustments.TongueOffsetY)));
        }
コード例 #5
0
ファイル: Player2.cs プロジェクト: ivanaltan/Frog-Pond
        public Player2(FliesCollection flies) : base(flies)
        {
            position  = new Point(875, Adjustments.Ground);
            id        = 2;
            direction = false;
            img1      = Properties.Resources.frog2_1;
            img2      = Properties.Resources.frog2_2;
            imgjump   = Properties.Resources.frog2_jump;
            img1F     = Properties.Resources.frog2_1;
            img1F.RotateFlip(RotateFlipType.RotateNoneFlipX);
            img2F = Properties.Resources.frog2_2;
            img2F.RotateFlip(RotateFlipType.RotateNoneFlipX);
            imgjumpF = Properties.Resources.frog2_jump;
            imgjumpF.RotateFlip(RotateFlipType.RotateNoneFlipX);

            CreateTongue();
        }
コード例 #6
0
ファイル: Player3.cs プロジェクト: ivanaltan/Frog-Pond
        public Player3(FliesCollection flies) : base(flies)
        {
            position = new Point(487, Adjustments.Ground);

            direction = (CustomRandom.GetNumber(0, 2) != 0);
            id        = 3;
            img1      = Properties.Resources.frog3_1;
            img2      = Properties.Resources.frog3_2;
            imgjump   = Properties.Resources.frog3_jump;
            img1F     = Properties.Resources.frog3_1;
            img1F.RotateFlip(RotateFlipType.RotateNoneFlipX);
            img2F = Properties.Resources.frog3_2;
            img2F.RotateFlip(RotateFlipType.RotateNoneFlipX);
            imgjumpF = Properties.Resources.frog3_jump;
            imgjumpF.RotateFlip(RotateFlipType.RotateNoneFlipX);

            CreateTongue();
        }