public Map(Tile[] baseTiles, Point tilesOnScreen) { this.baseTiles = baseTiles; this.tilesOnScreen = tilesOnScreen; sizeOfTile = new Point(baseTiles[1].TileWidth, baseTiles[1].TileHeight); mapOrigin = Vector2.Zero; mapOffset = Vector2.Zero; }
public Tile(Tile tile) : base(tile.TextureImage, tile.Position, tile.FrameSize, tile.CollisionOffset, tile.CurrentFrame, tile.SheetSize, tile.Speed, tile.MillisecondsPerFrame) { isBackground = tile.isBackground; isDestructible = tile.isDestructible; isEatable = tile.isEatable; IsAlive = tile.IsAlive; type = 0; }
// ##################### temporäre Karte ################################# public void loadMap() { mapArray = generateMap(); sizeInTiles = new Point(mapArray.GetLength(0), mapArray.GetLength(1)); sizeInPixel = new Point(sizeInTiles.X * sizeOfTile.X, sizeInTiles.Y * sizeOfTile.Y); tileArray = new Tile[sizeInTiles.X, sizeInTiles.Y]; for (int x = 0; x < sizeInTiles.X; ++x) for (int y = 0; y < sizeInTiles.Y; ++y) tileArray[x, y] = new Tile(); for (int x = 0; x < sizeInTiles.X; ++x) for (int y = 0; y < sizeInTiles.Y; ++y) if(mapArray[x,y] != 0) tileArray[x, y] = new Tile(baseTiles[mapArray[x,y]]); }
private void initializeTiles() { // Tiles erstellen Texture2D tileTex; Vector2 tilePosition; Point tileFrameSize; Point tileCurrentFrame; Point tileSheetSize; Vector2 tileSpeed; baseTiles[0] = new Tile(); tileTex = Content.Load<Texture2D>(@"Images\gnd"); tilePosition = Vector2.Zero; tileFrameSize = new Point(tileSize.X, tileSize.Y); tileCurrentFrame = new Point(0, 0); tileSheetSize = new Point(1, 1); tileSpeed = new Vector2(0, 0); baseTiles[1] = new Tile(tileTex, tilePosition, tileFrameSize, tileCurrentFrame, tileSheetSize, tileSpeed, 1); tileTex = Content.Load<Texture2D>(@"Images\stone"); baseTiles[2] = new Tile(tileTex, tilePosition, tileFrameSize, tileCurrentFrame, tileSheetSize, tileSpeed, 2); }