Beispiel #1
0
        /*public static string mediaPath;

        public static void SetMediaPath(string thePath)
        {
            mediaPath = thePath;
        }*/
        public static void SetPanelSize(Panel thePanel, Form theForm, Tile[,] theTiles, int mapType)
        {
            int newPnlWidth, newPnlHeight, newFrmHeight, newFrmWidth;
            newPnlWidth = (theTiles.GetLength(0) + 1) * 50;
            newPnlHeight = (theTiles.GetLength(1) + 1) * 50;
            thePanel.Size = new Size(newPnlWidth, newPnlHeight);

            if (mapType == 1)
            {
                newFrmWidth = newPnlWidth + 250;
                if (newPnlHeight > 400)
                {
                    newFrmHeight = newPnlHeight + 40;
                    theForm.Size = new Size(newFrmWidth, newFrmHeight);
                }
                else
                {
                    theForm.Size = new Size(newFrmWidth, 435);
                }
            }
            if (mapType == 2)
            {
                if (newPnlWidth < 475)
                {
                    newFrmWidth = 475;
                }
                else
                {
                    newFrmWidth = newPnlWidth;
                }

                newFrmHeight = newPnlHeight + 50;
                theForm.Size = new Size(newFrmWidth, newFrmHeight);
            }
        }
Beispiel #2
0
        internal static Tile[,] CreateMap(int newWidth, int newHeight)
        {
            Tile[,] Map;
            int width = newWidth, height = newHeight;
            Map = new Tile[width, height];

            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    Map[x, y] = new Tile(x, y);
                }
            }
            return Map;
        }
Beispiel #3
0
        public static void SetPanelSize(Panel thePanel, Form theForm, Tile[,] theTiles, int mapType)
        {
            int newPnlWidth, newPnlHeight, newFrmHeight, newFrmWidth;
            newPnlWidth = (theTiles.GetLength(0) + 1) * 50;
            newPnlHeight = (theTiles.GetLength(1) + 1) * 50;
            thePanel.Size = new Size(newPnlWidth, newPnlHeight);

            // builder
            if (mapType == 1)
            {
                newFrmWidth = newPnlWidth + 250;
                if (newPnlHeight > 470)
                {
                    newFrmHeight = newPnlHeight + 40;
                    theForm.Size = new Size(newFrmWidth, newFrmHeight);
                }
                else
                {
                    theForm.Size = new Size(newFrmWidth, 470);
                }
            }

            // game, no button controls
            if (mapType == 2)
            {
                if (newPnlWidth < 475)
                {
                    newFrmWidth = 475;
                }
                else
                {
                    newFrmWidth = newPnlWidth;
                }

                newFrmHeight = newPnlHeight + 160;
                theForm.Size = new Size(newFrmWidth, newFrmHeight);
            }
        }
Beispiel #4
0
        internal static String ObjectsToString(Tile[,] theMap, Theseus theTheseus, Minotaur theMinotaur)
        {
            string output = "";
            int width = theMap.GetLength(0);
            int height = theMap.GetLength(1);

            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    output += ".";
                    if (theMap[x, y].MyWalls.HasFlag(TheWalls.North))
                    {
                        output += "___";
                    }
                    else
                    {
                        output += "   ";
                    }

                }
                output += ".\n";

                for (int x = 0; x < width; x++)
                {
                    if (x != width - 1)
                    {
                        if (theMap[x, y].MyWalls.HasFlag(TheWalls.West) && !theMap[x, y].MyWalls.HasFlag(TheWalls.End))
                        {
                            output += "|   ";
                        }
                        if (!theMap[x, y].MyWalls.HasFlag(TheWalls.West) && !theMap[x, y].MyWalls.HasFlag(TheWalls.End))
                        {
                            output += "    ";
                        }

                        if (theMap[x, y].MyWalls.HasFlag(TheWalls.West) && !theMap[x, y].MyWalls.HasFlag(TheWalls.East) && theMap[x, y].MyWalls.HasFlag(TheWalls.End))
                        {
                            output += "| X ";
                        }
                        if (theMap[x, y].MyWalls.HasFlag(TheWalls.West) && theMap[x, y].MyWalls.HasFlag(TheWalls.East) && theMap[x, y].MyWalls.HasFlag(TheWalls.End))
                        {
                            output += "| X ";
                        }
                        if (!theMap[x, y].MyWalls.HasFlag(TheWalls.West) && theMap[x, y].MyWalls.HasFlag(TheWalls.East) && theMap[x, y].MyWalls.HasFlag(TheWalls.End))
                        {
                            output += "  X ";
                        }
                        if (!theMap[x, y].MyWalls.HasFlag(TheWalls.West) && !theMap[x, y].MyWalls.HasFlag(TheWalls.East) && theMap[x, y].MyWalls.HasFlag(TheWalls.End))
                        {
                            output += "  X ";
                        }
                    }

                    if (x == width - 1)
                    {
                        if (theMap[x, y].MyWalls.HasFlag(TheWalls.West) && !theMap[x, y].MyWalls.HasFlag(TheWalls.East) && !theMap[x, y].MyWalls.HasFlag(TheWalls.End))
                        {
                            output += "|    ";
                        }
                        if (theMap[x, y].MyWalls.HasFlag(TheWalls.West) && theMap[x, y].MyWalls.HasFlag(TheWalls.East) && !theMap[x, y].MyWalls.HasFlag(TheWalls.End))
                        {
                            output += "|   |";
                        }
                        if (!theMap[x, y].MyWalls.HasFlag(TheWalls.West) && theMap[x, y].MyWalls.HasFlag(TheWalls.East) && !theMap[x, y].MyWalls.HasFlag(TheWalls.End))
                        {
                            output += "    |";
                        }
                        if (!theMap[x, y].MyWalls.HasFlag(TheWalls.West) && !theMap[x, y].MyWalls.HasFlag(TheWalls.East) && !theMap[x, y].MyWalls.HasFlag(TheWalls.End))
                        {
                            output += "     ";
                        }

                        if (theMap[x, y].MyWalls.HasFlag(TheWalls.West) && !theMap[x, y].MyWalls.HasFlag(TheWalls.East) && theMap[x, y].MyWalls.HasFlag(TheWalls.End))
                        {
                            output += "| X  ";
                        }
                        if (theMap[x, y].MyWalls.HasFlag(TheWalls.West) && theMap[x, y].MyWalls.HasFlag(TheWalls.East) && theMap[x, y].MyWalls.HasFlag(TheWalls.End))
                        {
                            output += "| X |";
                        }
                        if (!theMap[x, y].MyWalls.HasFlag(TheWalls.West) && theMap[x, y].MyWalls.HasFlag(TheWalls.East) && theMap[x, y].MyWalls.HasFlag(TheWalls.End))
                        {
                            output += "  X |";
                        }
                        if (!theMap[x, y].MyWalls.HasFlag(TheWalls.West) && !theMap[x, y].MyWalls.HasFlag(TheWalls.East) && theMap[x, y].MyWalls.HasFlag(TheWalls.End))
                        {
                            output += "  X  ";
                        }
                    }

                    /*** Fixes:
                     * 17/11
                        fixed bad spacing when T & M on same row
                     * 18/11
                     *  changed fix to when T/M on furthest column
                        */
                    if (x == theMinotaur.Coordinate.X && y == theMinotaur.Coordinate.Y)
                    {

                        StringBuilder minoPosition = new StringBuilder(output);
                        if (x == width - 1)//(OnSameLine(theTheseus, theMinotaur) && theTheseus.Coordinate.X < theMinotaur.Coordinate.X && x == (width - 1))
                        {
                            minoPosition[output.Length - 3] = 'M';
                        }
                        else
                        {
                            minoPosition[output.Length - 2] = 'M';
                        }

                        output = minoPosition.ToString();
                    }
                    if (x == theTheseus.Coordinate.X && y == theTheseus.Coordinate.Y)
                    {
                        StringBuilder thesPosition = new StringBuilder(output);
                        if (x == width - 1)//(OnSameLine(theTheseus, theMinotaur) && theTheseus.Coordinate.X > theMinotaur.Coordinate.X && x == (width - 1))
                        {
                            thesPosition[output.Length - 3] = 'T';
                        }
                        else
                        {
                            thesPosition[output.Length - 2] = 'T';
                        }

                        output = thesPosition.ToString();
                    }
                }
                output += "\n";

            }

            // lowest row of map
            for (int x = 0; x < width; x++)
            {
                output += ".";
                if (theMap[x, height - 1].MyWalls.HasFlag(TheWalls.South))
                {
                    output += "___";
                }
                else
                {
                    output += "   ";
                }
            }
            output += ".";

            return output;
        }
 //int theX, int theY)
 public void SelectTile(Point newTile)
 {
     theTile = theMap.Tiles[newTile.X, newTile.Y];
 }