Esempio n. 1
0
        static Tile()
        {
            Tiles = new Dictionary<string, Tile>();

            var t = new Tile(false);
            t.ID = TileID.None;
            t.Texture = null;
            t.TileType = TileType.Empty;
            t.Solid = false;
            Tiles.Add(t.TileType.ToString(), t);

            t = new Tile(false);
            t.ID = TileID.Platform;
            t.Texture = Graphics.Textures.DarkGround;
            t.TileType = TileType.DarkGround;
            Tiles.Add(t.TileType.ToString(), t);

            t = new Tile(false);
            t.Texture = Graphics.Textures.DarkGroundBottom;
            t.ID = TileID.Platform;
            t.TileType = TileType.DarkGroundBottom;
            Tiles.Add(t.TileType.ToString(), t);

            t = new Tile(false);
            t.Texture = Graphics.Textures.DarkGroundBottomLeftCorner;
            t.ID = TileID.Platform;
            t.TileType = TileType.DarkGroundBottomLeftCorner;
            Tiles.Add(t.TileType.ToString(), t);

            t = new Tile(false);
            t.Texture = Graphics.Textures.DarkGroundBottomRightCorner;
            t.ID = TileID.Platform;
            t.TileType = TileType.DarkGroundBottomRightCorner;
            Tiles.Add(t.TileType.ToString(), t);

            t = new Tile(false);
            t.Texture = Graphics.Textures.DarkGroundGrass;
            t.ID = TileID.GrassPlatform;
            t.TileType = TileType.DarkGroundGrass;
            Tiles.Add(t.TileType.ToString(), t);

            t = new Tile(false);
            t.Texture = Graphics.Textures.DarkGroundGrassEndLeft;
            t.ID = TileID.Platform;
            t.TileType = TileType.DarkGroundGrassEndLeft;
            Tiles.Add(t.TileType.ToString(), t);

            t = new Tile(false);
            t.Texture = Graphics.Textures.DarkGroundGrassEndRight;
            t.ID = TileID.Platform;
            t.TileType = TileType.DarkGroundGrassEndRight;
            Tiles.Add(t.TileType.ToString(), t);

            t = new Tile(false);
            t.Texture = Graphics.Textures.DarkGroundGrassLeft;
            t.ID = TileID.LeftGrassPlatform;
            t.TileType = TileType.DarkGroundGrassLeft;
            Tiles.Add(t.TileType.ToString(), t);

            t = new Tile(false);
            t.Texture = Graphics.Textures.DarkGroundGrassRight;
            t.ID = TileID.RightGrassPlatform;
            t.TileType = TileType.DarkGroundGrassRight;
            Tiles.Add(t.TileType.ToString(), t);

            t = new Tile(false);
            t.Texture = Graphics.Textures.DarkGroundLeftWall;
            t.ID = TileID.Platform;
            t.TileType = TileType.DarkGroundLeftWall;
            Tiles.Add(t.TileType.ToString(), t);

            t = new Tile(false);
            t.Texture = Graphics.Textures.DarkGroundRightWall;
            t.ID = TileID.Platform;
            t.TileType = TileType.DarkGroundRightWall;
            Tiles.Add(t.TileType.ToString(), t);

            t = new Tile(false);
            t.Texture = Graphics.Textures.DarkGroundRightWallBottomGrass;
            t.ID = TileID.Platform;
            t.TileType = TileType.DarkGroundRightWallBottomGrass;
            Tiles.Add(t.TileType.ToString(), t);

            t = new Tile(false);
            t.Texture = Graphics.Textures.DarkGroundRightWallTopBottomGrass;
            t.ID = TileID.Platform;
            t.TileType = TileType.DarkGroundRightWallTopBottomGrass;
            Tiles.Add(t.TileType.ToString(), t);

            t = new Tile(false);
            t.Texture = Graphics.Textures.DarkGroundRightWallTopGrass;
            t.ID = TileID.Platform;
            t.TileType = TileType.DarkGroundRightWallTopGrass;
            Tiles.Add(t.TileType.ToString(), t);
        }
Esempio n. 2
0
        public void SetTile(Tile t)
        {
            if(t == null)
                return;

            Tile _t = new Tile();
            _t.ID = t.ID;
            _t.Position = new Vector2((int)(t.Position.X / Tile.WIDTH), (int)(t.Position.Y / Tile.HEIGHT));
            _t.Texture = t.Texture;
            _t.Solid = t.Solid;
            _t.TileType = t.TileType;

            tile[(int)(_t.Position.X), (int)(_t.Position.Y)] = _t;
        }
Esempio n. 3
0
        public void CreateNewLevel(Theme theme, int width, int height, string name)
        {
            tile = new Tile[width, height];
            this.Width = width;
            this.Height = height;
            this.Theme = theme;
            this.Name = name;
            this.PlayerSpawn = Vector2.Zero;
            CurrentLevel = this;

            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    SetEmptyTile(x, y);
                }
            }

            ScreenManagers.GameScreen gs = (ScreenManagers.GameScreen)ScreenManagers.ScreenManager.CurrentScreen;
            gs.RemoveAllEntities();
            gs.RemoveAllGameObjects();
            gs.Player.Position = PlayerSpawn;
            gs.Player.AllowMovement = true;
            gs.camera.LevelWidth = Width * Tile.WIDTH;
            gs.camera.LevelHeight = Height * Tile.HEIGHT;
        }
Esempio n. 4
0
        public void SetTile(int x, int y, Tile t)
        {
            Tile _t = new Tile();
            _t.ID = t.ID;
            _t.Position = new Vector2(x, y);
            _t.Texture = t.Texture;
            _t.Solid = t.Solid;
            _t.TileType = t.TileType;

            tile[x / Tile.WIDTH, y / Tile.HEIGHT] = _t;
        }
Esempio n. 5
0
        private void InitializeMap()
        {
            tile = new Tile[Width, Height];

            for (int x = 0; x < Width; x++)
            {
                for (int y = 0; y < Height; y++)
                {
                    SetEmptyTile(x, y);
                }
            }
        }