Java 类com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile 实例源码

项目:Space-Bombs    文件:Item.java   
public Item(MapCellCoordinates cellPos, TextureRegion itemTexture, MapLoader map, EntityManager entityManager) 
{
    super(new ThinGridCoordinates(cellPos.getX(), cellPos.getY()), new ThinGridCoordinates(0,0), map, entityManager);

    this.emptyBlock = TextureManager.emptyBlock;
    this.cellPos = cellPos;
    this.sendCommand = entityManager.getSendCommand();



    if(!map.isCellBlocked(cellPos)){
    //Render Item once
    TiledMapTileLayer.Cell cell = new TiledMapTileLayer.Cell();
    cell.setTile(new StaticTiledMapTile(itemTexture));
    map.getItemLayer().setCell(cellPos.getX(), cellPos.getY(), cell);
    }else{
        collected = true;
    }
}
项目:Space-Bombs    文件:PoisonGas.java   
@Override
public void render()
{
    if(!map.isCellBlocked(cellPos))
    {
        //Create new cell and set its animation texture
        TiledMapTileLayer.Cell cell = new TiledMapTileLayer.Cell();
        cell.setTile(new StaticTiledMapTile(animEffects.getFrame(blockAnim, true)));
        cell.getTile().getProperties().put("poisonGas", null);

        //Set texture into block layer
        blockLayer.setCell(super.cellPos.getX(), super.cellPos.getY(), cell);
    }else
    {
        super.destroyed = true;
    }
}
项目:Space-Bombs    文件:Turret.java   
public void deleteUp(){
    for(int y=1; y <= explosionRange; y++){
        TiledMapTileLayer.Cell cell = new TiledMapTileLayer.Cell();
        cell.setTile(new StaticTiledMapTile(emptyBlock));

        //If explosion hits block
        if(map.isCellBlocked(new MapCellCoordinates(cellPos.getX(), cellPos.getY() + y)))
        {
            //Delete explosion effect
            map.getBombLayer().setCell(cellPos.getX(), cellPos.getY() + y, cell);

            //Delete block
            deleteBlock(new MapCellCoordinates(cellPos.getX(), cellPos.getY() + y));

            break;
        }

        //Explosion down
        map.getBombLayer().setCell(cellPos.getX(), cellPos.getY() + y, cell);
        deleteBlock(new MapCellCoordinates(cellPos.getX(), cellPos.getY() + y));
    }
}
项目:Space-Bombs    文件:Turret.java   
public void deleteRight(){
    for(int x=1; x <= explosionRange; x++){
        TiledMapTileLayer.Cell cell = new TiledMapTileLayer.Cell();
        cell.setTile(new StaticTiledMapTile(emptyBlock));

        //If explosion hits block
        if(map.isCellBlocked(new MapCellCoordinates(cellPos.getX() + x, cellPos.getY())))
        {
            //Delete explosion effect
            map.getBombLayer().setCell(cellPos.getX() + x, cellPos.getY(), cell);

            //Delete block
            deleteBlock(new MapCellCoordinates(cellPos.getX() + x, cellPos.getY()));

            break;
        }

        //Explosion down
        map.getBombLayer().setCell(cellPos.getX() + x, cellPos.getY(), cell);
        deleteBlock(new MapCellCoordinates(cellPos.getX() + x, cellPos.getY()));
    }
}
项目:Space-Bombs    文件:Turret.java   
public void deleteDown(){
    for(int y=1; y <= explosionRange; y++){
        TiledMapTileLayer.Cell cell = new TiledMapTileLayer.Cell();
        cell.setTile(new StaticTiledMapTile(emptyBlock));

        //If explosion hits block
        if(map.isCellBlocked(new MapCellCoordinates(cellPos.getX(), cellPos.getY() - y)))
        {
            //Delete explosion effect
            map.getBombLayer().setCell(cellPos.getX(), cellPos.getY() - y, cell);

            //Delete block
            deleteBlock(new MapCellCoordinates(cellPos.getX(), cellPos.getY() - y));

            break;
        }

        //Explosion down
        map.getBombLayer().setCell(cellPos.getX(), cellPos.getY() - y, cell);
        deleteBlock(new MapCellCoordinates(cellPos.getX(), cellPos.getY() - y));
    }
}
项目:Space-Bombs    文件:Turret.java   
public void deleteLeft(){
    for(int x=1; x <= explosionRange; x++){
        TiledMapTileLayer.Cell cell = new TiledMapTileLayer.Cell();
        cell.setTile(new StaticTiledMapTile(emptyBlock));

        //If explosion hits block
        if(map.isCellBlocked(new MapCellCoordinates(cellPos.getX() - x, cellPos.getY())))
        {
            //Delete explosion effect
            map.getBombLayer().setCell(cellPos.getX() - x, cellPos.getY(), cell);

            //Delete block
            deleteBlock(new MapCellCoordinates(cellPos.getX() - x, cellPos.getY()));

            break;
        }

        //Explosion down
        map.getBombLayer().setCell(cellPos.getX() - x, cellPos.getY(), cell);
        deleteBlock(new MapCellCoordinates(cellPos.getX() - x, cellPos.getY()));
    }
}
项目:TTmath    文件:LevelAnimationManager.java   
public void createL0Animation(Texture tileTexture, String tag){

        //hardcoded grass texture region
        Tile = new Array<StaticTiledMapTile>();

        Tile.add(new StaticTiledMapTile(new TextureRegion(tileTexture,0,0,32,32)));
        Tile.add(new StaticTiledMapTile(new TextureRegion(tileTexture,32,0,32,32)));
        Tile.add(new StaticTiledMapTile(new TextureRegion(tileTexture,64,0,32,32)));

        TiledMapTileLayer layer = (TiledMapTileLayer) map.getLayers().get(0);
        for(int x = 0; x < layer.getWidth();x++){
            for(int y = 0; y < layer.getHeight();y++){
                TiledMapTileLayer.Cell cell = layer.getCell(x,y);
                Object property = cell.getTile().getProperties().get(tag);
                if(property != null){
                    cell.setTile(new AnimatedTiledMapTile(1.5f,Tile));
                }
            }
        }
    }
项目:TTmath    文件:LevelAnimationManager.java   
public void createL1SmallAnimation(Texture tileTexture, String tag){

        //hardcoded grass texture region
        Tile = new Array<StaticTiledMapTile>();

        Tile.add(new StaticTiledMapTile(new TextureRegion(tileTexture,0,0,32,32)));
        Tile.add(new StaticTiledMapTile(new TextureRegion(tileTexture,32,0,32,32)));
        Tile.add(new StaticTiledMapTile(new TextureRegion(tileTexture,64,0,32,32)));

        TiledMapTileLayer layer = (TiledMapTileLayer) map.getLayers().get(1);
        for(int x = 0; x < layer.getWidth();x++){
            for(int y = 0; y < layer.getHeight();y++){
                TiledMapTileLayer.Cell cell = layer.getCell(x,y);
                if(cell!=null && cell.getTile().getProperties().get(tag)!=null){
                    cell.setTile(new AnimatedTiledMapTile(1.5f,Tile));
                }
            }
        }
    }
项目:TTmath    文件:LevelAnimationManager.java   
public void createL1LargeAnimation(Texture tileTexture, String tag){

        //hardcoded grass texture region
        Tile = new Array<StaticTiledMapTile>();

        Tile.add(new StaticTiledMapTile(new TextureRegion(tileTexture,0,0,64,64)));
        Tile.add(new StaticTiledMapTile(new TextureRegion(tileTexture,64,0,64,64)));
        Tile.add(new StaticTiledMapTile(new TextureRegion(tileTexture,128,0,64,64)));

        TiledMapTileLayer layer = (TiledMapTileLayer) map.getLayers().get(1);
        for(int x = 0; x < layer.getWidth();x++){
            for(int y = 0; y < layer.getHeight();y++){
                TiledMapTileLayer.Cell cell = layer.getCell(x,y);
                if(cell!=null && cell.getTile().getProperties().get(tag)!=null){
                    cell.setTile(new AnimatedTiledMapTile(1.5f,Tile));
                }
            }
        }
    }
项目:Space-Bombs    文件:Item.java   
/**
 * Deletes item texture in cell.
 */
public void deleteItem()
{
    TiledMapTileLayer.Cell cellCenter = new TiledMapTileLayer.Cell();
    cellCenter.setTile(new StaticTiledMapTile(emptyBlock));
    map.getItemLayer().setCell(cellPos.getX(), cellPos.getY(), cellCenter);
    collected = true;
}
项目:Space-Bombs    文件:Coin.java   
@Override
public void render()
{
    //Render item
    TiledMapTileLayer.Cell cell = new TiledMapTileLayer.Cell();
    cell.setTile(new StaticTiledMapTile(animEffects.getFrame(TextureManager.coinAnim, true)));
    map.getItemLayer().setCell(cellPos.getX(), cellPos.getY(), cell);

    super.deleteItemThroughBomb();

    if(isMainPlayerCollectingItem() == true)
    {
        itemEffect();
    }

    if(getPlayerIdCollectingItem() != -1)
    {
        sound = AudioManager.getSingleCoin();
        soundId = sound.play();
    }

    Player player = entityManager.getPlayerManager().getCurrentPlayerObject();
    if(player != null && sound != null)
    {
        player.playSoundInDistance(sound, soundId, pos, Constants.COINMOD);
    }
}
项目:Space-Bombs    文件:Bomb.java   
/**
 * Deltes block on given cell position. Spawns also a coin randomly on destroyed blocks.
 * If it is undestructable nothing happens and false gets returned.
 * @param x: Cell position on x axis
 * @param y: Cell position on y axis
 * @return boolean
 */ 
protected boolean deleteBlock(MapCellCoordinates localCellPos)
{
    Cell currentCell = blockLayer.getCell(localCellPos.getX() , localCellPos.getY());

    if(currentCell != null)
    {
        //If block is undestructable
        if(currentCell.getTile().getProperties().containsKey("undestructable"))
        {
            return false;

        }else
        {
            //Delete block with empty texture
            Cell cell = new Cell();
            cell.setTile(new StaticTiledMapTile(emptyBlock));
            map.getBlockLayer().setCell(localCellPos.getX(), localCellPos.getY(), cell);


            /**---------------------RANDOM COIN---------------------**/
            //Check for a bug and if main player placed that bomb
            if(currentCell.getTile().getId() != cell.getTile().getId() && playerId == Constants.PLAYERID)
            {
                dropFromBlock(localCellPos);
            }
        }
    }

    // If there is no block 
    return true;
}
项目:Space-Bombs    文件:Turret.java   
public void explodeUp(){
    //Explode UP
    for(int y=1; y <= explosionRange; y++)
    {
        //If explosion hits block
        if(map.isCellBlocked(new MapCellCoordinates(cellPos.getX(), cellPos.getY() + y )))
        {
            //Set ending texture and break out of loop
            TiledMapTileLayer.Cell cellDown = new TiledMapTileLayer.Cell();
            cellDown.setTile(new StaticTiledMapTile(explosionUpEnd));
            cellDown.getTile().getProperties().put("deadly", null);

            map.getBombLayer().setCell(super.cellPos.getX(), super.cellPos.getY() + y, cellDown);
            break;
        }

        if(y != explosionRange) // If not end of explosion
        {
            TiledMapTileLayer.Cell cell = new TiledMapTileLayer.Cell();
            cell.setTile(new StaticTiledMapTile(explosionYMiddle));
            cell.getTile().getProperties().put("deadly", null);

            map.getBombLayer().setCell(super.cellPos.getX(), super.cellPos.getY() + y, cell);
        }else
        {
            //Set end of explosion
            TiledMapTileLayer.Cell cellUp = new TiledMapTileLayer.Cell();
            cellUp.setTile(new StaticTiledMapTile(explosionUpEnd));
            cellUp.getTile().getProperties().put("deadly", null);

            map.getBombLayer().setCell(super.cellPos.getX(), super.cellPos.getY() + y, cellUp);
        }
    }
}
项目:Space-Bombs    文件:Turret.java   
public void explodeRight(){
    //Explode RIGHT
    for(int x=1; x <= explosionRange; x++)
    {
        //If explosion hits block
        if(map.isCellBlocked(new MapCellCoordinates(cellPos.getX() +x, cellPos.getY())))
        {
            //Set ending texture and break out of loop
            TiledMapTileLayer.Cell cellDown = new TiledMapTileLayer.Cell();
            cellDown.setTile(new StaticTiledMapTile(explosionRightEnd));
            cellDown.getTile().getProperties().put("deadly", null);

            map.getBombLayer().setCell(super.cellPos.getX() +x, super.cellPos.getY(), cellDown);
            break;
        }

        if(x != explosionRange)  // If not end of explosion
        {
            //Set cell with middle explosion texture
            TiledMapTileLayer.Cell cell = new TiledMapTileLayer.Cell();
            cell.setTile(new StaticTiledMapTile(explosionXMiddle));
            cell.getTile().getProperties().put("deadly", null);

            map.getBombLayer().setCell(super.cellPos.getX() +x, super.cellPos.getY(), cell);

        }else
        {
            //Set end of explosion
            TiledMapTileLayer.Cell cellRight = new TiledMapTileLayer.Cell();
            cellRight.setTile(new StaticTiledMapTile(explosionRightEnd));
            cellRight.getTile().getProperties().put("deadly", null);

            map.getBombLayer().setCell(super.cellPos.getX() +x, super.cellPos.getY(), cellRight);
        }
    }
}
项目:Space-Bombs    文件:Turret.java   
public void explodeDown(){
    for(int y=1; y <= explosionRange; y++)
    {
        //If explosion hits block
        if(map.isCellBlocked(new MapCellCoordinates(cellPos.getX(), cellPos.getY() - y )))
        {
            //Set ending texture and break out of loop
            TiledMapTileLayer.Cell cellDown = new TiledMapTileLayer.Cell();
            cellDown.setTile(new StaticTiledMapTile(explosionDownEnd));
            cellDown.getTile().getProperties().put("deadly", null);

            map.getBombLayer().setCell(super.cellPos.getX(), super.cellPos.getY() - y, cellDown);
            break;
        }

        if(y != explosionRange) // If not end of explosion
        {
            TiledMapTileLayer.Cell cell = new TiledMapTileLayer.Cell();
            cell.setTile(new StaticTiledMapTile(explosionYMiddle));
            cell.getTile().getProperties().put("deadly", null);

            map.getBombLayer().setCell(super.cellPos.getX(), super.cellPos.getY() - y, cell);
        }else
        {
            //Set end of explosion
            TiledMapTileLayer.Cell cellUp = new TiledMapTileLayer.Cell();
            cellUp.setTile(new StaticTiledMapTile(explosionDownEnd));
            cellUp.getTile().getProperties().put("deadly", null);

            map.getBombLayer().setCell(super.cellPos.getX(), super.cellPos.getY() - y, cellUp);
        }
    }
}
项目:Space-Bombs    文件:Turret.java   
public void explodeLeft(){
    //Explode LEFT
    for(int x=1; x <= explosionRange; x++)
    {
        //If explosion hits block
        if(map.isCellBlocked(new MapCellCoordinates(cellPos.getX() -x, cellPos.getY())))
        {
            //Set ending texture and break out of loop
            TiledMapTileLayer.Cell cellDown = new TiledMapTileLayer.Cell();
            cellDown.setTile(new StaticTiledMapTile(explosionLeftEnd));
            cellDown.getTile().getProperties().put("deadly", null);

            map.getBombLayer().setCell(super.cellPos.getX() -x, super.cellPos.getY(), cellDown);
            break;
        }

        if(x != explosionRange)  // If not end of explosion
        {
            //Set cell with middle explosion texture
            TiledMapTileLayer.Cell cell = new TiledMapTileLayer.Cell();
            cell.setTile(new StaticTiledMapTile(explosionXMiddle));
            cell.getTile().getProperties().put("deadly", null);

            map.getBombLayer().setCell(super.cellPos.getX() -x, super.cellPos.getY(), cell);

        }else
        {
            TiledMapTileLayer.Cell cellLeft = new TiledMapTileLayer.Cell();
            cellLeft.setTile(new StaticTiledMapTile(explosionLeftEnd));
            cellLeft.getTile().getProperties().put("deadly", null);

            map.getBombLayer().setCell(super.cellPos.getX() -x, super.cellPos.getY(), cellLeft);
        }
    }
}
项目:Space-Bombs    文件:CubicBomb.java   
@Override
public void explode(Sound sound){
    //cubic explosion for barrel and dynamite
    //own constant cubic explosion range [1,2,3]
    //dynamite max 2


    //To Execute the sound only once
    if(ExplodeAudioId == -1 && sound != null)
    {
        ExplodeAudioId = sound.play();
    }

    Player player = entityManager.getPlayerManager().getCurrentPlayerObject();
    if(player != null && sound != null)
    {
        player.playSoundInDistance(sound, ExplodeAudioId, pos, Constants.CUBICBOMBEXPLOSIONMOD);
    }

    TiledMapTileLayer.Cell cell = new TiledMapTileLayer.Cell();
    cell.setTile(new StaticTiledMapTile(explosionCubic));
    cell.getTile().getProperties().put("deadly", null);





    for (int i = super.cellPos.getX() - cubicRange; i <= super.cellPos.getX() + cubicRange; i++){
        for (int j = super.cellPos.getY() - cubicRange; j <= super.cellPos.getY() + cubicRange; j++){
            map.getBombLayer().setCell(i, j, cell);
        }
    }

}
项目:Space-Bombs    文件:BlackHole.java   
private void animateBomb()
{
    //Create new cell and set its animation texture
    TiledMapTileLayer.Cell cell = new TiledMapTileLayer.Cell();
    cell.setTile(new StaticTiledMapTile(animEffects.getFrame(bombAnim, true)));
    cell.getTile().getProperties().put("bomb", null);

    //Set bomb into bomb layer
    map.getBombLayer().setCell(super.cellPos.getX(), super.cellPos.getY(), cell);
}
项目:fabulae    文件:AnimatedTile.java   
public AnimatedTile(float frameDuration, Array<StaticTiledMapTile> frameTiles, boolean randomDelay, boolean randomAnimation) {
    super(frameDuration, frameTiles);
    this.frameDuration = frameDuration;
    numberOfFrames = frameTiles.size;
    this.animationDuration = frameDuration * numberOfFrames;
    this.frameTiles = frameTiles;
    this.hasRandomDelay = randomDelay;
    this.randomized = randomAnimation;
}
项目:libgdxcn    文件:AnimatedTiledMapTile.java   
/** Creates an animated tile with the given animation interval and frame tiles.
 * 
 * @param interval The interval between each individual frame tile.
 * @param frameTiles An array of {@link StaticTiledMapTile}s that make up the animation. */
public AnimatedTiledMapTile (float interval, Array<StaticTiledMapTile> frameTiles) {
    this.frameTiles = new StaticTiledMapTile[frameTiles.size];
    this.frameCount = frameTiles.size;

    this.loopDuration = frameTiles.size * (int)(interval * 1000f);
    this.animationIntervals = new int[frameTiles.size];
    for (int i = 0; i < frameTiles.size; ++i){
        this.frameTiles[i] = frameTiles.get(i);
        this.animationIntervals[i] = (int)(interval * 1000f);
    }
}
项目:libgdxcn    文件:AnimatedTiledMapTile.java   
/** Creates an animated tile with the given animation intervals and frame tiles.
 *
 * @param intervals The intervals between each individual frame tile in milliseconds.
 * @param frameTiles An array of {@link StaticTiledMapTile}s that make up the animation. */
public AnimatedTiledMapTile (IntArray intervals, Array<StaticTiledMapTile> frameTiles) {
    this.frameTiles = new StaticTiledMapTile[frameTiles.size];
    this.frameCount = frameTiles.size;

    this.animationIntervals = intervals.toArray();
    this.loopDuration = 0;

    for (int i = 0; i < intervals.size; ++i){
        this.frameTiles[i] = frameTiles.get(i);
        this.loopDuration += intervals.get(i);
    }
}
项目:libgdxcn    文件:HexagonalTiledMapTest.java   
@Override
public void create () {
    super.create();
    float w = Gdx.graphics.getWidth();
    float h = Gdx.graphics.getHeight();

    camera = new OrthographicCamera();
    camera.setToOrtho(false, (w / h) * 480, 480);
    camera.update();

    cameraController = new OrthoCamController(camera);
    Gdx.input.setInputProcessor(cameraController);

    hexture = new Texture(Gdx.files.internal("data/maps/tiled/hex/hexes.png"));
    TextureRegion[][] hexes = TextureRegion.split(hexture, 112, 97);
    map = new TiledMap();
    MapLayers layers = map.getLayers();
    TiledMapTile[] tiles = new TiledMapTile[3];
    tiles[0] = new StaticTiledMapTile(new TextureRegion(hexes[0][0]));
    tiles[1] = new StaticTiledMapTile(new TextureRegion(hexes[0][1]));
    tiles[2] = new StaticTiledMapTile(new TextureRegion(hexes[1][0]));

    for (int l = 0; l < 1; l++) {
        TiledMapTileLayer layer = new TiledMapTileLayer(45, 30, 112, 97);
        for (int y = 0; y < 30; y++) {
            for (int x = 0; x < 45; x++) {
                int id = (int)(Math.random() * 3);
                Cell cell = new Cell();
                cell.setTile(tiles[id]);
                layer.setCell(x, y, cell);
            }
        }
        layers.add(layer);
    }

    renderer = new HexagonalTiledMapRenderer(map);
}
项目:libgdxcn    文件:TiledMapBench.java   
@Override
public void create () {
    float w = Gdx.graphics.getWidth();
    float h = Gdx.graphics.getHeight();

    camera = new OrthographicCamera();
    camera.setToOrtho(false, (w / h) * 320, 320);
    camera.update();

    cameraController = new OrthoCamController(camera);
    Gdx.input.setInputProcessor(cameraController);

    font = new BitmapFont();
    batch = new SpriteBatch();

    {
        tiles = new Texture(Gdx.files.internal("data/maps/tiled/tiles.png"));
        TextureRegion[][] splitTiles = TextureRegion.split(tiles, 32, 32);
        map = new TiledMap();
        MapLayers layers = map.getLayers();
        for (int l = 0; l < 20; l++) {
            TiledMapTileLayer layer = new TiledMapTileLayer(150, 100, 32, 32);
            for (int x = 0; x < 150; x++) {
                for (int y = 0; y < 100; y++) {
                    int ty = (int)(Math.random() * splitTiles.length);
                    int tx = (int)(Math.random() * splitTiles[ty].length);
                    Cell cell = new Cell();
                    cell.setTile(new StaticTiledMapTile(splitTiles[ty][tx]));
                    layer.setCell(x, y, cell);
                }
            }
            layers.add(layer);
        }
    }

    renderer = new OrthogonalTiledMapRenderer(map);

}
项目:libgdx-maps    文件:MapManager.java   
/** Appends this tile to our map, will be rendered for the appropriate layer */
private void addToTiledMap(TextureTile tile) {
    OSMTileLayer layer = getLayer(zoom);
    TiledMapTileLayer.Cell cell = new TiledMapTileLayer.Cell();
    cell.setTile(new StaticTiledMapTile(new TextureRegion(tile.getImage())));
    cell.setFlipVertically(true);
    int x = tile.getX();
    int y = tile.getY();

    // logger.info(String.format("Adds tile: x=%d, y=%d", x, y));
    layer.setCell(x, y, cell);
    redraw = true;
}
项目:Missing_Words    文件:World.java   
public World(MissingWords missingWords) {
    this.missingWords = missingWords;

    t = new Timer();

    /* Cargamos el mapa */
    tileMap = new TmxMapLoader().load("minigame.tmx");

    /* Creamos el MapRenderer y lo asociamos a nuestra camara del stage */
    renderer = new OrthogonalTiledMapRenderer(tileMap, missingWords.getSB());
    renderer.setView((OrthographicCamera) missingWords.getGameScreen().getStage().getViewport().getCamera());

    /* Creamos las losetas */
    playerTile = new StaticTiledMapTile(new TextureRegion((MissingWords.myManager.get("player.png", Texture.class))));
    npcTile = new StaticTiledMapTile(new TextureRegion((MissingWords.myManager.get("npc.png", Texture.class))));
    transparentTile = new StaticTiledMapTile(new TextureRegion((MissingWords.myManager.get("transparentTile.png", Texture.class))));        
    holeTile = new StaticTiledMapTile(new TextureRegion((MissingWords.myManager.get("holeGrass.png", Texture.class))));
    bothPlayers = new StaticTiledMapTile(new TextureRegion((MissingWords.myManager.get("bothPlayers.png", Texture.class))));

    /* Obtenemos las capas del mapa */
    pathLayer = (TiledMapTileLayer) tileMap.getLayers().get("Path");
    tokenLayer = (TiledMapTileLayer) tileMap.getLayers().get("Tokens");

    generateHoles();

    createSquares();

    placePlayers();
}
项目:mario-game    文件:Tiles.java   
public static Array<StaticTiledMapTile> getAnimatedTile(String name) {
    Array<AtlasRegion> regions = atlas.findRegions(name);
    Array<StaticTiledMapTile> frames = new Array<StaticTiledMapTile>();
    for(int i = 0; i < regions.size; i++) {
        frames.add(new StaticTiledMapTile(regions.get(i)));
    }
    return frames;
}
项目:Space-Bombs    文件:Barrel.java   
@Override
public void render()
{
    //To make sure no bomb gets placed into wall
    if(!map.isCellBlocked(new MapCellCoordinates(pos.getX(), pos.getY())) && !isExploded)
    {
        //Execute fuse sound
        if(soundId == -1)
        {
            placeSound = AudioManager.getBarrelPlace();
            soundId = placeSound.play();
        }

        Player player = entityManager.getPlayerManager().getCurrentPlayerObject();
        if(player != null && placeSound != null)
        {
            player.playSoundInDistance(placeSound, soundId, pos, Constants.BARRELFUSEMOD);
        }

        //Check if bomb has been hit by deadly tile
        if(map.isCellDeadly(new MapCellCoordinates(pos.getX(), pos.getY())) && hasBombTouchedDeadlyTile == false && timerTillExplosion < explosionTime)
        {
            //To delay the explosion after beeing hit from another bomb
            timerTillExplosion = explosionTime - delayExplodeAfterHitByBomb;

            hasBombTouchedDeadlyTile = true;
        }

        //If time to explode or deadly tile has been touched
        if(timerTillExplosion >= explosionTime)
        {
            placeSound.stop();
            explode(AudioManager.getBigBombExplosion());

            //Delete explosion effect after a while
            if(timerTillExplosionDelete >= explosionDuration)
            {
                deleteCubicExplosionEffect();

                //Object gets delete only set if everything is done.
                this.isExploded = true;
            }else
            {
                //Add passed time to timer
                timerTillExplosionDelete += Constants.DELTATIME;
            }

        }else if(!hasBombTouchedDeadlyTile)//Creates bomb animation
        {
            //Create new cell and set its animation texture
            TiledMapTileLayer.Cell cell = new TiledMapTileLayer.Cell();
            cell.setTile(new StaticTiledMapTile(animEffects.getFrame(bombAnim, true)));
            cell.getTile().getProperties().put("bomb", null);

            //Set bomb into bomb layer
            map.getBombLayer().setCell(super.cellPos.getX(), super.cellPos.getY(), cell);
        }


        //Add passed time to timer
        if(hasBombTouchedDeadlyTile == true){
            timerTillExplosion += Constants.DELTATIME;
        }

    }else //If bomb placed in wall
    {
        //Delete bomb object.
        this.isExploded = true;
    }
}
项目:Space-Bombs    文件:Dynamite.java   
@Override
public void render()
{
    //To make sure no bomb gets placed into wall
    if(!map.isCellBlocked(new MapCellCoordinates(pos.getX(), pos.getY())) && !isExploded)
    {


        //Execute fuse sound
        if(soundId == -1)
        {
            fuseSound = AudioManager.getBombFuse();
            soundId = fuseSound.play();
        }

        Player player = entityManager.getPlayerManager().getCurrentPlayerObject();
        if(player != null)
        {
            player.playSoundInDistance(fuseSound, soundId, pos, Constants.DYNAMITEFUSEMOD);
        }

        //Check if bomb has been hit by deadly tile
        if(map.isCellDeadly(new MapCellCoordinates(pos.getX(), pos.getY())) && hasBombTouchedDeadlyTile == false && timerTillExplosion < explosionTime)
        {
            //To delay the explosion after beeing hit from another bomb
            timerTillExplosion = explosionTime - delayExplodeAfterHitByBomb;

            hasBombTouchedDeadlyTile = true;
        }

        //If time to explode or deadly tile has been touched
        if(timerTillExplosion >= explosionTime)
        {
            fuseSound.stop();
            explode(AudioManager.getBigBombExplosion());

            //Delete explosion effect after a while
            if(timerTillExplosionDelete >= explosionDuration)
            {
                deleteCubicExplosionEffect();

                //Object gets delete only set if everything is done.
                this.isExploded = true;
            }else
            {
                //Add passed time to timer
                timerTillExplosionDelete += Constants.DELTATIME;
            }

        }else if(!hasBombTouchedDeadlyTile)//Creates bomb animation
        {
            //Create new cell and set its animation texture
            TiledMapTileLayer.Cell cell = new TiledMapTileLayer.Cell();
            cell.setTile(new StaticTiledMapTile(animEffects.getFrame(bombAnim, true)));
            cell.getTile().getProperties().put("bomb", null);

            //Set bomb into bomb layer
            map.getBombLayer().setCell(super.cellPos.getX(), super.cellPos.getY(), cell);
        }

        //Add passed time to timer
        timerTillExplosion += Constants.DELTATIME;

    }else //If bomb placed in wall
    {
        //Delete bomb object.
        this.isExploded = true;
    }
}
项目:Space-Bombs    文件:NormalBomb.java   
@Override
public void render()
{
    //To make sure no bomb gets placed into wall
    if(!map.isCellBlocked(new MapCellCoordinates(pos.getX(), pos.getY())) && !isExploded)
    {
        //Check if bomb has been hit by deadly tile
        if(map.isCellDeadly(new MapCellCoordinates(pos.getX(), pos.getY())) && hasBombTouchedDeadlyTile == false && timerTillExplosion < explosionTime)
        {
            //To delay the explosion after beeing hit from another bomb
            timerTillExplosion = explosionTime - delayExplodeAfterHitByBomb;

            hasBombTouchedDeadlyTile = true;
        }

        //If time to explode or deadly tile has been touched
        if(timerTillExplosion >= explosionTime)
        {
            explode(AudioManager.getNormalExplosion());

            //Delete explosion effect after a while
            if(timerTillExplosionDelete >= explosionDuration)
            {
                deleteExplosionEffect(explosionRange, explosionRange, explosionRange, explosionRange);

                //Object gets delete only set if everything is done.
                this.isExploded = true;
            }else
            {
                //Add passed time to timer
                timerTillExplosionDelete += Constants.DELTATIME;
            }

        }else if(!hasBombTouchedDeadlyTile)//Creates bomb animation
        {
            //Create new cell and set its animation texture
            TiledMapTileLayer.Cell cell = new TiledMapTileLayer.Cell();
            cell.setTile(new StaticTiledMapTile(animEffects.getFrame(bombAnim, true)));
            cell.getTile().getProperties().put("bomb", null);

            //Set bomb into bomb layer
            map.getBombLayer().setCell(super.cellPos.getX(), super.cellPos.getY(), cell);
        }

        //Add passed time to timer
        timerTillExplosion += Constants.DELTATIME;

    }else //If bomb placed in wall
    {
        //Delete bomb object.
        this.isExploded = true;
    }
}
项目:Space-Bombs    文件:RemoteBomb.java   
@Override
public void render()
{
    //To make sure no bomb gets placed into wall
    if(!map.isCellBlocked(new MapCellCoordinates(pos.getX(), pos.getY())) && !isExploded)
    {
        //Execute fuse sound
        if(soundId == -1)
        {
            fuseSound = AudioManager.getRemoteBombPlace();
            soundId = fuseSound.play();
        }

        Player player = entityManager.getPlayerManager().getCurrentPlayerObject();
        if(player != null && fuseSound != null)
        {
            player.playSoundInDistance(fuseSound, soundId, pos, Constants.REMOTEBOMBFUSEMOD);
        }

        //Check if bomb has been hit by deadly tile
        if(map.isCellDeadly(new MapCellCoordinates(pos.getX(), pos.getY())) && hasBombTouchedDeadlyTile == false && timerTillExplosion < explosionTime)
        {
            //To delay the explosion after beeing hit from another bomb
            timerTillExplosion = explosionTime - delayExplodeAfterHitByBomb;

            hasBombTouchedDeadlyTile = true;
        }

        if(hasBombTouchedDeadlyTile || activated)
        {
            //if deadly tile has been touched or it has been activated
            if(timerTillExplosion >= explosionTime)
            {
                fuseSound.stop();
                explode(AudioManager.getNormalExplosion());

                //Delete explosion effect after a while
                if(timerTillExplosionDelete >= explosionDuration)
                {
                    deleteExplosionEffect(explosionRange, explosionRange, explosionRange, explosionRange);

                    //Object gets delete only set if everything is done.
                    this.isExploded = true;
                }else
                {
                    //Add passed time to timer
                    timerTillExplosionDelete += Constants.DELTATIME;
                }
            }else
            {
                //Add passed time to timer
                timerTillExplosion += Constants.DELTATIME;
            }
        }

        if(!hasBombTouchedDeadlyTile && !activated)//Creates bomb animation
        {
            //Create new cell and set its animation texture
            TiledMapTileLayer.Cell cell = new TiledMapTileLayer.Cell();
            cell.setTile(new StaticTiledMapTile(animEffects.getFrame(bombAnim, true)));
            cell.getTile().getProperties().put("bomb", null);

            //Set bomb into bomb layer
            map.getBombLayer().setCell(super.cellPos.getX(), super.cellPos.getY(), cell);
        }

    }else //If bomb placed in wall
    {
        //Delete bomb object.
        this.isExploded = true;
    }
}
项目:Space-Bombs    文件:InfinitySplitBomb.java   
@Override
public void render()
{
    //To make sure no bomb gets placed into wall
    if(!map.isCellBlocked(new MapCellCoordinates(pos.getX(), pos.getY())) && !isExploded)
    {
        //Execute fuse sound
        if(soundId == -1)
        {
            fuseSound = AudioManager.getGranadeClipDrop();
            soundId = fuseSound.play();
        }

        Player player = entityManager.getPlayerManager().getCurrentPlayerObject();
        if(player != null && fuseSound != null)
        {
            player.playSoundInDistance(fuseSound, soundId, pos, Constants.INFINITYFUSEMOD);
        }

        //Check if bomb has been hit by deadly tile
        if(map.isCellDeadly(new MapCellCoordinates(pos.getX(), pos.getY())) && hasBombTouchedDeadlyTile == false && timerTillExplosion < explosionTime)
        {
            //To delay the explosion after beeing hit from another bomb
            timerTillExplosion = explosionTime - delayExplodeAfterHitByBomb;

            hasBombTouchedDeadlyTile = true;
        }

        //If time to explode or deadly tile has been touched
        if(timerTillExplosion >= explosionTime)
        {
            fuseSound.stop();
            explode(AudioManager.getNormalExplosion());

            //Delete explosion effect after a while
            if(timerTillExplosionDelete >= explosionDuration)
            {
                deleteExplosionEffect(explosionRange, explosionRange, explosionRange, explosionRange);

                //Object gets delete only set if everything is done.
                this.isExploded = true;
            }else
            {
                //Add passed time to timer
                timerTillExplosionDelete += Constants.DELTATIME;
            }

        }else if(!hasBombTouchedDeadlyTile)//Creates bomb animation
        {
            //Create new cell and set its animation texture
            TiledMapTileLayer.Cell cell = new TiledMapTileLayer.Cell();
            cell.setTile(new StaticTiledMapTile(animEffects.getFrame(bombAnim, true)));
            cell.getTile().getProperties().put("bomb", null);

            //Set bomb into bomb layer
            map.getBombLayer().setCell(super.cellPos.getX(), super.cellPos.getY(), cell);
        }

        //Add passed time to timer
        timerTillExplosion += Constants.DELTATIME;

    }else //If bomb placed in wall
    {
        //Delete bomb object.
        this.isExploded = true;
    }
}
项目:Space-Bombs    文件:X3.java   
@Override
public void render()
{
    //To make sure no bomb gets placed into wall
    if(!map.isCellBlocked(new MapCellCoordinates(pos.getX(), pos.getY())) && !isExploded)
    {
        //Execute fuse sound
        if(soundId == -1)
        {
            fuseSound = AudioManager.getAlienTimerSound();
            soundId = fuseSound.play();
        }

        Player player = entityManager.getPlayerManager().getCurrentPlayerObject();
        if(player != null && fuseSound != null)
        {
            player.playSoundInDistance(fuseSound, soundId, pos, Constants.X3FUSEMOD);
        }

        //Check if bomb has been hit by deadly tile
        if(map.isCellDeadly(new MapCellCoordinates(pos.getX(), pos.getY())) && hasBombTouchedDeadlyTile == false && timerTillExplosion < explosionTime)
        {
            //To delay the explosion after beeing hit from another bomb
            timerTillExplosion = explosionTime - delayExplodeAfterHitByBomb;

            hasBombTouchedDeadlyTile = true;
        }

        //If time to explode or deadly tile has been touched
        if(timerTillExplosion >= explosionTime)
        {
            fuseSound.stop();
            explode(AudioManager.getNormalExplosion());

            //Delete explosion effect after a while
            if(timerTillExplosionDelete >= explosionDuration)
            {
                deleteExplosionEffect(explosionRange, explosionRange, explosionRange, explosionRange);

                //Object gets delete only set if everything is done.
                this.isExploded = true;

                /**-------------------CHANGED-------------------**/
                // Increase range by 1
                super.setRange(super.getRange() + 1);
                X += 1;                    

                if(X <= explosionRepeat && !map.isBombPlaced(new MapCellCoordinates(pos.getX(), pos.getY())))
                {   
                    entityManager.getBombManager().spawnBomb(new X3(pos, playerId, super.getRange(), X, explosionRepeat, map, entityManager));
                }
            }else
            {
                //Add passed time to timer
                timerTillExplosionDelete += Constants.DELTATIME;
            }

        }else if(!hasBombTouchedDeadlyTile)//Creates bomb animation
        {
            //Create new cell and set its animation texture
            TiledMapTileLayer.Cell cell = new TiledMapTileLayer.Cell();
            cell.setTile(new StaticTiledMapTile(animEffects.getFrame(bombAnim, true)));
            cell.getTile().getProperties().put("bomb", null);

            //Set bomb into bomb layer
            map.getBombLayer().setCell(super.cellPos.getX(), super.cellPos.getY(), cell);
        }

        //Add passed time to timer
        timerTillExplosion += Constants.DELTATIME;

    }else //If bomb placed in wall
    {
        //Delete bomb object.
        this.isExploded = true;
    }
}
项目:Space-Bombs    文件:HomingBomb.java   
@Override
public void render() 
{
    //To make sure no bomb gets placed into wall
    if(!map.isCellBlocked(new MapCellCoordinates(pos.getX(), pos.getY())) && !isExploded)
    {
        //Check if bomb has been hit by deadly tile
        if(map.isCellDeadly(new MapCellCoordinates(pos.getX(), pos.getY())) && hasBombTouchedDeadlyTile == false && timerTillExplosion < explosionTime)
        {
            //To delay the explosion after beeing hit from another bomb
            timerTillExplosion = explosionTime - delayExplodeAfterHitByBomb;

            hasBombTouchedDeadlyTile = true;
        }

        //If time to explode or deadly tile has been touched
        if(timerTillExplosion >= explosionTime)
        {
            explode(AudioManager.getNormalExplosion());

            //Delete explosion effect after a while
            if(timerTillExplosionDelete >= explosionDuration)
            {
                deleteExplosionEffect(explosionRange, explosionRange, explosionRange, explosionRange);

                //Object gets delete only set if everything is done.
                this.isExploded = true;
            }else
            {
                //Add passed time to timer
                timerTillExplosionDelete += Constants.DELTATIME;
            }

        }else if(!hasBombTouchedDeadlyTile)//Creates bomb animation
        {
            //Create new cell and set its animation texture
            TiledMapTileLayer.Cell cell = new TiledMapTileLayer.Cell();
            cell.setTile(new StaticTiledMapTile(animEffects.getFrame(bombAnim, true)));
            cell.getTile().getProperties().put("bomb", null);

            //Set bomb into bomb layer
            map.getBombLayer().setCell(super.cellPos.getX(), super.cellPos.getY(), cell);
        }

        //Add passed time to timer
        timerTillExplosion += Constants.DELTATIME;

    }else //If bomb placed in wall
    {
        //Delete bomb object.
        this.isExploded = true;
    }
}
项目:Space-Bombs    文件:CubicBomb.java   
protected void deleteCubicExplosionEffect()
{

    TiledMapTileLayer.Cell cell = new TiledMapTileLayer.Cell();
    cell.setTile(new StaticTiledMapTile(emptyBlock));

    for (int i = super.cellPos.getX() - cubicRange; i <= super.cellPos.getX() + cubicRange; i++){
        for (int j = super.cellPos.getY() - cubicRange; j <= super.cellPos.getY() + cubicRange; j++){

            if(map.isCellBlocked(new MapCellCoordinates(i, j)))
            {

                //Delete block
                deleteBlock(new MapCellCoordinates(i, j));

            }
            map.getBombLayer().setCell(i, j, cell);

        }
    }

}
项目:TTmath    文件:Player.java   
private void openFinalDoor(Cell cell) {
    if(cell !=null && cell.getTile().getProperties().containsKey("finaldoor")){
        cell.setTile(new StaticTiledMapTile(new TextureRegion(new TextureRegion(TextureManager.SPECIALDOOROPEN))));
        System.out.println("final door opened");
    }
}
项目:TTmath    文件:Player.java   
private void openDoor(Cell cell){
    if(cell !=null && cell.getTile().getProperties().containsKey("door")){
        cell.setTile(new StaticTiledMapTile(new TextureRegion(new TextureRegion(TextureManager.DOOROPEN))));
        System.out.println("door opened");
    }
}