Exemplo n.º 1
0
        public MapObject Clone()
        {
            MapObject mo = new MapObject();

            mo.source = new Rectangle(source.X, source.Y, source.Width, source.Height);
            mo.textureName = textureName;
            mo.origin = new Vector2(origin.X, origin.Y);
            mo.destination = new Rectangle(destination.X, destination.Y, destination.Width, destination.Height);

            mo.viewBlocking = viewBlocking;
            mo.throwableOver = throwableOver;
            mo.collectible = collectible;
            mo.type = type.Clone();
            mo.boundaries = boundaries.Clone();

            return mo;
        }
Exemplo n.º 2
0
        private void Level1()
        {
            GameMap = new GameMap(150, 150);

            MapTile t1 = new MapTile(new BackgroundSprite(@"Game\fire1", new Rectangle(6, 267, (int)GameMap.TileShift.X, (int)GameMap.TileShift.Y)), new List<MapObject>());
            MapTile t2 = new MapTile(new BackgroundSprite(@"Game\fire1", new Rectangle(6, 291, (int)GameMap.TileShift.X, (int)GameMap.TileShift.Y)), new List<MapObject>());
            MapTile t3 = new MapTile(new BackgroundSprite(@"Game\fire1", new Rectangle(6, 317, (int)GameMap.TileShift.X, (int)GameMap.TileShift.Y)), new List<MapObject>());
            MapObject mo = new MapObject();
            List<Vector2> punkty = new List<Vector2>();
            punkty.Add(new Vector2(-0.5f, 7));
            punkty.Add(new Vector2(24, 23));
            punkty.Add(new Vector2(48.5f, 7));
            punkty.Add(new Vector2(24, -2));

            mo.boundaries = Boundaries.CreateFromPoints(punkty);
            mo.collectible = false;
            mo.Source = new Source(539, 0, 48, 47);
            mo.textureName = @"Game\newtile";
            mo.throwableOver = true;
            mo.type = new Bonus();
            mo.viewBlocking = true;
            mo.origin = new Vector2(0, 24);

            for (int i = 0; i < 20; i++)
            {
                for (int j = 0; j < 40; j++)
                {
                    GameMap[i + j / 2, 40 - 2 * i + j] = new MapTile(new BackgroundSprite(@"Game\fire1", new Rectangle(6, 267, (int)GameMap.TileShift.X, (int)GameMap.TileShift.Y)), new List<MapObject>());
                    GameMap[i + j / 2 + 1, 40 - 2 * i + j] = new MapTile(new BackgroundSprite(@"Game\fire1", new Rectangle(6, 291, (int)GameMap.TileShift.X, (int)GameMap.TileShift.Y)), new List<MapObject>());
                }
            }

            for (int i = 0; i < 42; i++)
            {
                GameMap[i / 2, 42 - i].mapObjects.Add(mo.Clone());
                GameMap[i / 2 + 20, 82 - i].mapObjects.Add(mo.Clone());
            }

            GameMap[20, 43].mapObjects.Add(mo.Clone());
            GameMap[21, 44].mapObjects.Add(mo.Clone());

            GameMap[20, 30].mapObjects.Add(mo.Clone());
            GameMap[1, 11].mapObjects.Add(mo.Clone());

            GameMap[4, 60] = new MapTile(new BackgroundSprite(@"Game\fire1", new Rectangle(6, 267, (int)GameMap.TileShift.X, (int)GameMap.TileShift.Y)), new List<MapObject>());
            GameMap[4, 60].mapObjects.Add(mo.Clone());

            for (int i = 0; i < 70; i++)
            {
                GameMap[7, i*5] = new MapTile(new BackgroundSprite(@"Game\fire1", new Rectangle(6, 267, (int)GameMap.TileShift.X, (int)GameMap.TileShift.Y)), new List<MapObject>());
            }

            GameMap[0, 0] = new MapTile(new BackgroundSprite(@"Game\fire1", new Rectangle(6, 267, (int)GameMap.TileShift.X, (int)GameMap.TileShift.Y)), new List<MapObject>());
            GameMap[1, 1] = new MapTile(new BackgroundSprite(@"Game\fire1", new Rectangle(6, 267, (int)GameMap.TileShift.X, (int)GameMap.TileShift.Y)), new List<MapObject>());
            GameMap[10, 2] = new MapTile(new BackgroundSprite(@"Game\fire1", new Rectangle(6, 267, (int)GameMap.TileShift.X, (int)GameMap.TileShift.Y)), new List<MapObject>());
            GameMap[10, 3] = new MapTile(new BackgroundSprite(@"Game\fire1", new Rectangle(6, 267, (int)GameMap.TileShift.X, (int)GameMap.TileShift.Y)), new List<MapObject>());
            GameMap[13, 2] = new MapTile(new BackgroundSprite(@"Game\fire1", new Rectangle(6, 267, (int)GameMap.TileShift.X, (int)GameMap.TileShift.Y)), new List<MapObject>());
            GameMap[13, 3] = new MapTile(new BackgroundSprite(@"Game\fire1", new Rectangle(6, 267, (int)GameMap.TileShift.X, (int)GameMap.TileShift.Y)), new List<MapObject>());

            GameMap.Load(content);

            /*
            GameMap = new GameMap(50, 100);

            for (int i = 0; i < 50; i++)
                for (int j = 0; j < 100; j++)
                    GameMap.mapTiles[i][j] = new MapTile(new BackgroundSprite(@"Game\texture", new Rectangle(152, 379, (int)GameMap.TileShift.X, (int)GameMap.TileShift.Y)), new List<MapObject>());

            GameMap.Load(content);

            MapObject mo = new MapObject();
            List<Vector2> punkty = new List<Vector2>();
            punkty.Add(new Vector2(1, 6));
            punkty.Add(new Vector2(4, 13));
            punkty.Add(new Vector2(8, 13));
            punkty.Add(new Vector2(25, 0));
            mo.boundaries = Boundaries.CreateFromPoints(punkty);
            mo.collectible = false;
            mo.Source = new Source(372, 429, 30, 38);
            mo.textureName = @"Game\texture";
            mo.throwableOver = true;
            mo.type = new Bonus();
            mo.viewBlocking = true;
            mo.origin = new Vector2(0, 24);
            mo.Load(content);

            for (int i = 0; i < 50; i++)
                GameMap.mapTiles[i][10].mapObjects.Add(mo);

            mo = new MapObject();
            punkty.Clear();
            punkty.Add(new Vector2(40, 13));
            punkty.Add(new Vector2(43, 13));
            punkty.Add(new Vector2(46, 6));
            punkty.Add(new Vector2(25, 0));
            //punkty.Add(new Vector2(18, 2));
            mo.boundaries = Boundaries.CreateFromPoints(punkty);
            mo.collectible = false;
            mo.Source = new Source(403, 429, 30, 38);
            mo.textureName = @"Game\texture";
            mo.throwableOver = true;
            mo.type = new Bonus();
            mo.viewBlocking = true;
            mo.origin = new Vector2(-18, 24);
            mo.Load(content);

            for (int i = 0; i < 50; i++)
                GameMap.mapTiles[i][10].mapObjects.Add(mo);
            */
        }