Example #1
0
        static bool CheckForAccident()
        {
            bool smash = false;

            for (int index = 0; index < mouse.Count; index++)
            {
                if (mouse[index].PositionX <= horse.Width)
                {
                    if (mouse[index].PositionY + Mouse.Height() - 1 >= horse.PositionY && mouse[index].PositionY < horse.PositionY + horse.Height)
                    {
                        smash = true;
                        return(smash);
                    }
                }
                else
                {
                    break;
                }
            }

            if (area.PositionX >= 0 && area.PositionX < horse.Width)
            {
                for (int heightIndex = horse.PositionY - area.PositionY, rowIndex = 0; rowIndex < horse.Height; heightIndex++, rowIndex++)
                {
                    for (int widthIndex = 0, colIndex = area.PositionX; colIndex < horse.Width; widthIndex++, colIndex++)
                    {
                        if (horse.GetHorse[rowIndex][colIndex] != ' ' && area.GetArea[heightIndex][widthIndex] == '@')
                        {
                            area.RemoveBonus(heightIndex, widthIndex);
                            bonus++;
                        }
                        else if (horse.GetHorse[rowIndex][colIndex] != ' ' && area.GetArea[heightIndex][widthIndex] != ' ')
                        {
                            smash = true;
                            return(smash);
                        }
                    }
                }
            }
            else if (area.PositionX < 0)
            {
                for (int heightIndex = horse.PositionY - area.PositionY, rowIndex = 0; rowIndex < horse.Height; heightIndex++, rowIndex++)
                {
                    for (int widthIndex = Math.Abs(area.PositionX), colIndex = 0; colIndex < horse.Width; widthIndex++, colIndex++)
                    {
                        if (widthIndex < area.GetArea[0].Length)
                        {
                            if (horse.GetHorse[rowIndex][colIndex] != ' ' && area.GetArea[heightIndex][widthIndex] == '@')
                            {
                                area.RemoveBonus(heightIndex, widthIndex);
                                points += 100;
                                bonus++;
                            }
                            else if (horse.GetHorse[rowIndex][colIndex] != ' ' && area.GetArea[heightIndex][widthIndex] != ' ')
                            {
                                smash = true;
                                return(smash);
                            }
                        }
                    }
                }
            }

            return(smash);
        }