本文整理汇总了Java中com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile类的典型用法代码示例。如果您正苦于以下问题:Java StaticTiledMapTile类的具体用法?Java StaticTiledMapTile怎么用?Java StaticTiledMapTile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StaticTiledMapTile类属于com.badlogic.gdx.maps.tiled.tiles包,在下文中一共展示了StaticTiledMapTile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Item
import com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile; //导入依赖的package包/类
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;
}
}
示例2: render
import com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile; //导入依赖的package包/类
@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;
}
}
示例3: deleteUp
import com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile; //导入依赖的package包/类
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));
}
}
示例4: deleteRight
import com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile; //导入依赖的package包/类
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()));
}
}
示例5: deleteDown
import com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile; //导入依赖的package包/类
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));
}
}
示例6: deleteLeft
import com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile; //导入依赖的package包/类
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()));
}
}
示例7: createL0Animation
import com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile; //导入依赖的package包/类
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));
}
}
}
}
示例8: createL1SmallAnimation
import com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile; //导入依赖的package包/类
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));
}
}
}
}
示例9: createL1LargeAnimation
import com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile; //导入依赖的package包/类
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));
}
}
}
}
示例10: deleteItem
import com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile; //导入依赖的package包/类
/**
* 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;
}
示例11: render
import com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile; //导入依赖的package包/类
@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);
}
}
示例12: deleteBlock
import com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile; //导入依赖的package包/类
/**
* 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;
}
示例13: explodeUp
import com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile; //导入依赖的package包/类
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);
}
}
}
示例14: explodeRight
import com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile; //导入依赖的package包/类
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);
}
}
}
示例15: explodeDown
import com.badlogic.gdx.maps.tiled.tiles.StaticTiledMapTile; //导入依赖的package包/类
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);
}
}
}