Ejemplo n.º 1
0
 public void AddTile(Tile t, float xOffset = 0, int yOffset = 0)
 {
     tiles.Add((Tile)t.Clone());
     if (t.Width > profile.Width)
     {
         profile.Width = t.Width;
     }
     if (t.Height > profile.Height)
     {
         profile.Height = t.Height;
     }
     t.position.X = xOffset;
     t.position.Y = yOffset;
 }
Ejemplo n.º 2
0
 public TileMap(Tile defaultTile, int width, int height, SpriteBatch sb = null)
 {
     this.width = width;
     this.height = height;
     this.data = new Tile[height, width];
     for (int i = 0; i < height; i++)
         for (int j = 0; j < width; j++)
         {
             data[i, j] = (Tile)defaultTile.Clone();
             data[i, j].position.Y = i * defaultTile.Height;
             data[i, j].position.X = j * defaultTile.Width;
         }
     this.sb = sb;
     this.mainTile = defaultTile;
     luaEvents = new Dictionary<string, List<LuaFunction>>();
 }
Ejemplo n.º 3
0
 public TileMap(Tile defaultTile, int width, int height, SpriteBatch sb = null)
 {
     this.width  = width;
     this.height = height;
     this.data   = new Tile[height, width];
     for (int i = 0; i < height; i++)
     {
         for (int j = 0; j < width; j++)
         {
             data[i, j]            = (Tile)defaultTile.Clone();
             data[i, j].position.Y = i * defaultTile.Height;
             data[i, j].position.X = j * defaultTile.Width;
         }
     }
     this.sb       = sb;
     this.mainTile = defaultTile;
     luaEvents     = new Dictionary <string, List <LuaFunction> >();
 }
Ejemplo n.º 4
0
 public void AddTile(Tile t, float xOffset = 0, int yOffset = 0)
 {
     tiles.Add((Tile)t.Clone());
     if (t.Width > profile.Width) profile.Width = t.Width;
     if (t.Height > profile.Height) profile.Height = t.Height;
     t.position.X = xOffset;
     t.position.Y = yOffset;
 }
Ejemplo n.º 5
0
 public void AddObject(Tile t, Vector2 pos)
 {
     data[(int)pos.Y, (int)pos.X]            = (Tile)t.Clone();
     data[(int)pos.Y, (int)pos.X].position.X = pos.X * mainTile.Width;
     data[(int)pos.Y, (int)pos.X].position.Y = pos.Y * mainTile.Height;
 }
Ejemplo n.º 6
0
 public void AddObject(Tile t, Vector2 pos)
 {
     data[(int)pos.Y, (int)pos.X] = (Tile)t.Clone();
     data[(int)pos.Y, (int)pos.X].position.X = pos.X * mainTile.Width;
     data[(int)pos.Y, (int)pos.X].position.Y = pos.Y * mainTile.Height;
 }