Exemplo n.º 1
0
        public DanceScreen(Game1 eng, Player p)
        {
            engine = eng;
            screenWidth = engine.getScreenWidth();
            screenHeight = engine.getScreenWidth();

            if(screenWidth < 800)
            {
                screenWidth = 800;
            }
            tiles = new Tile[screenWidth / 32, screenHeight / 32];
            for (int x = 0; x < tiles.GetLength(0); x++ )
            {
                for(int y = 0; y < tiles.GetLength(1); y++ )
                {

                    int temp = rand.Next(3);
                    tiles[x,y] = new Tile(temp,x,y);
                }
            }
            makePoints();
            addPointOffset();
            player = p;
        }
Exemplo n.º 2
0
        public void makeMapFromFile(string filename)
        {
            int xposition = 0;
            int yposition = 0;

            //This directory navigation might have to change for the final product, or even sooner

            string[] lines = System.IO.File.ReadAllLines(@"../../../Map Files/" + filename);
            //string[] lines = System.IO.File.ReadAllLines(@System.IO.Directory.GetCurrentDirectory() + "/Map Files/" + filename);

            mapSizeX = lines[0].Length * 32;
            mapSizeY = lines.Length * 32;
            Game1.wallArray = new bool[lines.GetLength(0), lines[0].Length];
            Game1.darkTileArray = new double[lines.GetLength(0), lines[0].Length];
            foreach (string line in lines)
            {

                foreach (char c in line)
                {
                    string image = Textures.charToFileName[c];
                    string[] images = image.Split(',');
                    bool solid = (images[2].Length > 0);
                    /*if(c == 'a')
                    {
                        LevelTile t = new LevelTile(xposition, yposition, images[0], images[1], "schoolLevel",new Point(9 * 32, 9 * 32));
                        Game1.levelTiles.Add(t);
                        Game1.tiles.Add(t);
                    }
                    else if (c == 'b')
                    {
                        LevelTile t = new LevelTile(xposition, yposition, images[0], images[1], "houseLevel", new Point(9 * 32, 9 * 32));
                        Game1.levelTiles.Add(t);
                        Game1.tiles.Add(t);
                    }
                    else if (c == 'c')
                    {
                        LevelTile t = new LevelTile(xposition, yposition, images[0], images[1], "hubLevel", new Point(9 * 32, 9 * 32));
                        Game1.levelTiles.Add(t);
                        Game1.tiles.Add(t);
                    }*/
                    if (c == 'f')
                    {
                        BadTile t = new BadTile(xposition, yposition, images[0], images[1]);
                        Game1.playerActivateTiles.Add(t);
                        Game1.tiles.Add(t);
                    }
                    else if (c == 's')
                    {
                        GoodTile t = new GoodTile(xposition, yposition, images[0], images[1]);
                        Game1.playerActivateTiles.Add(t);
                        Game1.tiles.Add(t);
                    }
                    else if (c == 'l')
                    {
                        LockTile t = new LockTile(xposition, yposition, images[0], images[1]);
                        Game1.playerActivateTiles.Add(t);
                        Game1.tiles.Add(t);
                    }
                    else if (c == 'u')
                    {
                        UnlockTile t = new UnlockTile(xposition, yposition, images[0], images[1]);
                        Game1.playerActivateTiles.Add(t);
                        Game1.tiles.Add(t);
                    }
                    else if (c == 'g')
                    {
                        Grate t = new Grate(xposition, yposition, images[0], images[1]);
                        Game1.solidTiles.Add(t);
                        Game1.tiles.Add(t);
                        Game1.wallArray[yposition / 32, xposition / 32] = true;
                    }
                    else if (c == 'w')
                    {
                        Wall t = new Wall(xposition, yposition, images[0], images[1]);
                        t.setProjectileBlock(false);
                        Game1.solidTiles.Add(t);
                        Game1.tiles.Add(t);
                        //Game1.wallArray[yposition / 32, xposition / 32] = true;
                    }
                    else if (!solid)
                    {
                        Tile t = new Tile(xposition, yposition, images[0], images[1]);
                        Game1.tiles.Add(t);
                    }
                    else
                    {
                        Wall w = new Wall(xposition, yposition, images[0], images[1]);
                        Game1.solidTiles.Add(w);
                        Game1.tiles.Add(w);
                        Game1.wallArray[yposition / 32, xposition / 32] = true;
                    }
                    xposition += 32;
                }
                xposition = 0;
                yposition += 32;
            }
        }
Exemplo n.º 3
0
        public void makeMapFromFile(string filename)
        {
            int xposition = 0;
            int yposition = 0;

            //This directory navigation might have to change for the final product, or even sooner
            string[] lines = System.IO.File.ReadAllLines(@"../../../Map Files/" + filename);

            wallArray = new bool[lines.GetLength(0), lines[0].Length];
            foreach (string line in lines)
            {

                foreach (char c in line)
                {
                    string image = Textures.charToFileName[c];
                    string[] images = image.Split(',');
                    bool solid = (images[2].Length > 0);
                    if (c == 'f')
                    {
                        BadTile t = new BadTile(xposition, yposition, worldState, images[0], images[1]);
                        collidableTiles.Add(t);
                        tiles.Add(t);
                    }
                    else if (c == 's')
                    {
                        GoodTile t = new GoodTile(xposition, yposition, worldState, images[0], images[1]);
                        collidableTiles.Add(t);
                        tiles.Add(t);
                    }
                    else if (c == 'l')
                    {
                        LockTile t = new LockTile(xposition, yposition, worldState, images[0], images[1]);
                        collidableTiles.Add(t);
                        tiles.Add(t);
                    }
                    else if (c == 'u')
                    {
                        UnlockTile t = new UnlockTile(xposition, yposition, worldState, images[0], images[1]);
                        collidableTiles.Add(t);
                        tiles.Add(t);
                    }
                    else if (!solid)
                    {
                        Tile t = new Tile(xposition, yposition, worldState, images[0], images[1]);
                        tiles.Add(t);
                    }
                    else
                    {
                        Wall w = new Wall(xposition, yposition, worldState, images[0], images[1]);
                        collidableTiles.Add(w);
                        tiles.Add(w);
                        wallArray[yposition / 32, xposition / 32] = true;
                    }
                    xposition += 32;
                }
                xposition = 0;
                yposition += 32;
            }
        }
Exemplo n.º 4
0
        public void changeColors()
        {
            //if(ctr == 0)
            //{
                foreach(Point p in points)
                {
                    int temp = rand.Next(2);
                    tiles[p.X, p.Y].setColor(temp);
                }
            //}
            for (int x = 0; x < tiles.GetLength(0); x++)
            {
                for (int y = 0; y < tiles.GetLength(1); y++)
                {
                    if (!containsPoint(x,y))
                    {
                        int temp = rand.Next(2)+2;
                        tiles[x, y] = new Tile(temp, x, y);
                    }

                }
            }
        }