コード例 #1
0
        public void CollisionCheck()
        {
            //Checks to see if Roll has lost the game and takes user to game over screen
            if (doodoo.Collision(roll))
            {
                gameTimer.Enabled = false;

                Form           f   = this.FindForm();
                GameOverScreen gos = new GameOverScreen();

                f.Controls.Remove(this);
                f.Controls.Add(gos);

                gos.Focus();
            }

            //Removes power-up wall
            if (redpowerupEnabled)
            {
                redpowerupRec = new Rectangle(redpowerupX, redpowerupY, powerupSize, powerupSize);
                if (roll.Collision(redpowerupRec))
                {
                    wallPlaced        = false;
                    redpowerupEnabled = false;
                    turnCounter       = true;
                }
            }

            //Removes power-up speed boost
            if (bluepowerupEnabled)
            {
                bluepowerupRec = new Rectangle(bluepowerupX, bluepowerupY, powerupSize, powerupSize);
                if (roll.Collision(bluepowerupRec))
                {
                    bluepowerupEnabled = false;
                }
            }
        }