예제 #1
0
        void decideIfStar()
        {
            tet_random random       = new tet_random();
            int        highestBOnus = highestRowWithPieces(tet_constants.gameMatrix);

            if (highestBOnus != -1)//being and empty row
            {
                if (random.getRandomInt(tet_constants.CHANCE_POWERUP_STAR) == tet_constants.POWER_UP_OCCURED)
                {
                    //this piece's powerup;
                    int whatColumn = random.getRandomInt(10);
                    int whatRow    = random.getRandomInt(20 - highestBOnus);
                    //try
                    //{
                    tet_constants.gameMatrix[19 - whatRow, whatColumn]  = 1;
                    tet_constants.colorMatrix[19 - whatRow, whatColumn] = 'p';

                    Image image = Image.FromFile(tet_colors.STAR);
                    mainWindow.graphicsObj2.DrawImage(image, new Rectangle(260 + whatColumn * 30, 100 + (19 - whatRow) * 30, 30, 30));
                    //}
                    //catch
                    //{
                    //    //quick, dirty, slutty, filthy, disease ridden fix.
                    //}
                }
            }
        }
예제 #2
0
        public string getPieceColor(char pieceData)
        {
            //string[] shapes = { "I", "J", "L", "O", "S", "Z", "T" };
            string[] listColors = new string[10] {
                "png/block_white.png",
                "png/block_cyan.png",
                "png/block_blue.png",
                "png/block_orange.png",
                "png/block_yellow.png",
                "png/block_green.png",
                "png/block_purple.png",
                "png/block_red.png",
                "png/block_star.png",
                "png/block_bomb.png"
            };

            int        powerUpChance     = 0;
            string     returnStringColor = "";
            tet_random randomPowerup     = new tet_random();

            powerUpChance = randomPowerup.getRandomInt(tet_constants.CHANCE_POWERUP_STAR);

            switch (pieceData)
            {
            case 'i':
            {
                returnStringColor = listColors[1];
                return(returnStringColor);
            }

            case 'j':
            {
                returnStringColor = listColors[2];
                return(returnStringColor);
            }

            case 'l':
            {
                returnStringColor = listColors[3];
                return(returnStringColor);
            }

            case 'o':
            {
                returnStringColor = listColors[4];
                return(returnStringColor);
            }

            case 's':
            {
                returnStringColor = listColors[5];
                return(returnStringColor);
            }

            case 'z':
            {
                returnStringColor = listColors[6];
                return(returnStringColor);
            }

            case 't':
            {
                returnStringColor = listColors[7];
                return(returnStringColor);
            }

            case 'p':
            {
                returnStringColor = listColors[8];
                return(returnStringColor);
            }

            case 'b':
            {
                returnStringColor = listColors[9];
                return(returnStringColor);
            }

            default:
            {
                returnStringColor = listColors[0];
                return(returnStringColor);
            }         // default is blank
            }
        }
예제 #3
0
        void decideIfStar()
        {
            tet_random random = new tet_random();
            int highestBOnus = highestRowWithPieces(tet_constants.gameMatrix);
            if (highestBOnus != -1)//being and empty row
            {
                if (random.getRandomInt(tet_constants.CHANCE_POWERUP_STAR) == tet_constants.POWER_UP_OCCURED)
                {
                    //this piece's powerup;
                    int whatColumn = random.getRandomInt(10);
                    int whatRow = random.getRandomInt(20 - highestBOnus);
                    //try
                    //{
                    tet_constants.gameMatrix[19 - whatRow, whatColumn] = 1;
                    tet_constants.colorMatrix[19 - whatRow, whatColumn] = 'p';

                    Image image = Image.FromFile(tet_colors.STAR);
                    mainWindow.graphicsObj2.DrawImage(image, new Rectangle(260 + whatColumn * 30, 100 + (19 - whatRow) * 30, 30, 30));
                    //}
                    //catch
                    //{
                    //    //quick, dirty, slutty, filthy, disease ridden fix.
                    //}
                }
            }
        }