int tx = (int)(Math.random() * splitTiles[ty].length); Cell cell = new Cell(); cell.setTile(new StaticTiledMapTile(splitTiles[ty][tx])); layer.setCell(x, y, cell);
if (tile != null) { Cell cell = createTileLayerCell(flipHorizontally, flipVertically, flipDiagonally); cell.setTile(tile); layer.setCell(x, yUp ? height - 1 - y : y, cell);
if (tile != null) { Cell cell = createTileLayerCell(flipHorizontally, flipVertically, flipDiagonally); cell.setTile(tile); layer.setCell(x, flipY ? height - 1 - y : y, cell);
@Override public void onHeadHit(Mario mario) { if(getCell().getTile().getId() == BLANK_COIN) MarioBros.manager.get("audio/sounds/bump.wav", Sound.class).play(); else { if(object.getProperties().containsKey("mushroom")) { screen.spawnItem(new ItemDef(new Vector2(body.getPosition().x, body.getPosition().y + 16 / MarioBros.PPM), Mushroom.class)); MarioBros.manager.get("audio/sounds/powerup_spawn.wav", Sound.class).play(); } else MarioBros.manager.get("audio/sounds/coin.wav", Sound.class).play(); getCell().setTile(tileSet.getTile(BLANK_COIN)); Hud.addScore(100); } } }
public void chageTile(float xActor, float yActor){ int tiledPx = 32; //yourPixelPerTile. int ajusteX = xActor / tiledPx; int ajusteY = yActor / tiledPx; //get(0) is layer 0 in your tilemap TiledMapTileLayer tileid = (TiledMapTileLayer)mapActual.getLayers().get(0); TiledMapTileLayer.Cell cell = new TiledMapTileLayer.Cell(); //mapActual is your reference a your mapTile //MoldeTileSet is a name of the tileset in your map // and getTile(3) is a numbre 3 of de tileset image cell.setTile(mapActual.getTileSets().getTileSet("MoldeTileSet").getTile(3)); Gdx.app.log("ChangeTileInPosPlayer", ""); tileid.setCell(ajusteX, ajusteY, cell); Gdx.app.log("ChangeTileInPosPlayer", "ajusteY +1"); tileid.setCell(ajusteX, ajusteY + 1, cell); }
TiledMapTileLayer layer = (TiledMapTileLayer)map.getLayers().get(1); TiledMapTileLayer.Cell cell = layer.getCell((int)tile.x, (int)tile.y); TiledMapTile tile = cell != null ? cell.getTile() : null; if (tile != null) { switch (tile.getId()) { case TILE_SOLID: cell.setTile(crackedTile); break; case TILE_CRACKED: cell.setTile(null); break; } }
@Override public void onHeadHit(Mario mario) { if(mario.isBig()) { setCategoryFilter(MarioBros.DESTROYED_BIT); getCell().setTile(null); Hud.addScore(200); MarioBros.manager.get("audio/sounds/breakblock.wav", Sound.class).play(); } MarioBros.manager.get("audio/sounds/bump.wav", Sound.class).play(); }
if (tile != null) { Cell cell = createTileLayerCell(flipHorizontally, flipVertically, flipDiagonally); cell.setTile(tile); layer.setCell(x, flipY ? height - 1 - y : y, cell);
if (tile != null) { Cell cell = createTileLayerCell(flipHorizontally, flipVertically, flipDiagonally); cell.setTile(tile); layer.setCell(x, flipY ? height - 1 - y : y, cell);
int id = (int)(Math.random() * 3); Cell cell = new Cell(); cell.setTile(tiles[id]); layer.setCell(x, y, cell);