protected override void Initialize() { // Character character = new Character(Content.Load<Texture2D>("character_stand"), new Vector2(100,100), new Vector2(1f,1f), new Vector2(64,128)); // Tiles var blockTexture = Content.Load<Texture2D>("glowy_tile_multicolor"); tileMap = new TileMap(new Vector2(64, 64), blockTexture); tileMap.AddNewLayer(); var layer = tileMap.GetTileLayerByIndex(0); var rnd = new Random(); for (int x = 0; x < graphics.GraphicsDevice.Viewport.Width / 64 + 1; x++) { for (int y = 0; y < graphics.GraphicsDevice.Viewport.Height / 64 + 1; y++) { var animation = new TileAnimation(blockTexture, new Vector2(512, 512), rnd.Next(200, 500)); layer.AddNewTileToLayer(new Vector2(64, 64), new Vector2(x * 64, y* 64), Color.White, blockTexture, animation); } } base.Initialize(); }
public Tile(Vector2 size, Vector2 screenPosition, Color color, Texture2D texture, TileAnimation animation) { _size = size; _screenPosition = screenPosition; _color = color; _animation = animation; _texture = texture; _currentFrameTextureBounds = GetBounds(); }
public Tile() { _size = Vector2.Zero; _screenPosition = Vector2.Zero; _color = Color.White; _animation = null; _currentFrameTextureBounds = Rectangle.Empty; _texture = null; }
public void AddNewTileToLayer(Vector2 size, Vector2 screenPosition, Color color, Texture2D texture, TileAnimation animation) { var tile = new Tile(size, screenPosition, color, texture, animation); AddTileToLayer(tile); }