Example #1
0
        protected void UpdateTiles(Point prevPos, Point currPos)
        {
            BaseTile tile = MasterWorldManager.TileAt(prevPos);

            if (tile != null)
            {
                tile.Occupied = false;
            }

            tile = MasterWorldManager.TileAt(currPos);
            if (tile != null)
            {
                tile.Occupied = true;
            }
        }
Example #2
0
        protected void RenderMap(ref PlayerEntity player)
        {
            //Todo: need a better way to do this later
            Point currentPosition = new Point(0, 0);
            Point playerPosition  = new Point(player.Position.X, player.Position.Y);

            for (int y = 0; y < 4; y++)
            {
                for (int x = 0; x < 4; x++)
                {
                    currentPosition.X = x;
                    currentPosition.Y = y;
                    if (currentPosition == playerPosition)
                    {
                        Console.Write(" X ");
                        continue;
                    }
                    BaseTile tile = MasterWorldManager.TileAt(currentPosition);
                    if (tile != null)
                    {
                        if (tile.Type == TileType.Grass)
                        {
                            Console.Write(" ^ ");
                        }
                        else if (tile.Type == TileType.Lava)
                        {
                            Console.Write(" ~ ");
                        }
                    }
                }
                Console.WriteLine("");
            }
            Console.WriteLine("");
        }
Example #3
0
        protected void RenderMap(ref PlayerEntity player)
        {
            //Todo: need a better way to do this later
            Point currentPosition = new Point(0, 0);
            Point playerPosition  = new Point(player.Position.X, player.Position.Y);

            int[] currentMapDim = MasterWorldManager.GetCurrentMap().GetMapDimensions();

            int currentMapRows = currentMapDim[0];
            int currentMapCols = currentMapDim[1];

            if (currentMapRows < 0 || currentMapRows < 0)
            {
                Console.WriteLine("The rows or cols was not set when map was loaded. Exiting!");
                return;
            }
            for (int y = 0; y < currentMapRows; y++)
            {
                for (int x = 0; x < currentMapCols; x++)
                {
                    currentPosition.X = x;
                    currentPosition.Y = y;
                    if (currentPosition == playerPosition)
                    {
                        Console.Write(" X ");
                        continue;
                    }
                    BaseTile tile = MasterWorldManager.TileAt(currentPosition);
                    if (tile != null)
                    {
                        if (tile.Type == TileType.Grass)
                        {
                            Console.Write(" G ");
                        }
                        else if (tile.Type == TileType.Lava)
                        {
                            Console.Write(" L ");
                        }
                        else if (tile.Type == TileType.Water)
                        {
                            Console.Write(" W ");
                        }
                        else if (tile.Type == TileType.Void)
                        {
                            Console.Write(" % ");
                        }
                        else if (tile.Type == TileType.Transition)
                        {
                            Console.Write(" Tr ");
                        }
                        else
                        {
                            Console.Write(" ERROR ");
                        }
                    }
                }
                Console.WriteLine("");
            }
            Console.WriteLine("");
        }