本文整理汇总了Java中org.newdawn.slick.tiled.TiledMap.getHeight方法的典型用法代码示例。如果您正苦于以下问题:Java TiledMap.getHeight方法的具体用法?Java TiledMap.getHeight怎么用?Java TiledMap.getHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.newdawn.slick.tiled.TiledMap
的用法示例。
在下文中一共展示了TiledMap.getHeight方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MazeModality
import org.newdawn.slick.tiled.TiledMap; //导入方法依赖的package包/类
/**
* @param mazeMap
* @param mazeView
* @throws SlickException
*/
public MazeModality(TiledMap mazeMap,MazeView mazeView) throws SlickException {
this.addObserver(mazeView);
tileWidth = mazeMap.getTileWidth();
tileHeight = mazeMap.getTileHeight();
mazeWidth = mazeMap.getWidth();
mazeHeight = mazeMap.getHeight();
initializationTiles(mazeView);
pacman = new PacMan(tileWidth, tileHeight, mazeWidth, tiles);
clyde = new Clyde(tileWidth, tileHeight, mazeWidth, tiles);
blinky = new Blinky(tileWidth, tileHeight, mazeWidth, tiles);
inky = new Inky(tileWidth, tileHeight, mazeWidth, tiles);
pinky = new Pinky(tileWidth, tileHeight, mazeWidth, tiles);
eatGhost = new Sound("data/pacmanSound/eatGhost.wav");
death = new Sound("data/pacmanSound/death.wav");
eatSuperPill = new Sound("data/pacmanSound/eatSuperPill.wav");
}
示例2: updateEntityFieldList
import org.newdawn.slick.tiled.TiledMap; //导入方法依赖的package包/类
/**
* Aktualizuje pola aktywne na mapie
* Kolizje, NpcArea,MobsArea
* @param map mapa
*/
public void updateEntityFieldList(TiledMap map) {
for (int i = 8; i < 11; i++) {
exist = new boolean[map.getWidth()][map.getHeight()];
testField = map.getTileId(0, 0, i);
for (int j = 0; j < map.getWidth(); j++) {
for (int k = 0; k < map.getHeight(); k++) {
collisionTileID = map.getTileId(j, k, i);
if (collisionTileID == testField) {
exist[j][k] = true;
}
}
}
if (i == 8) {
updateCollisionFields(map);
}
if (i == 9) {
updateNpcFields(map);
}
if (i == 10) {
updateMobsFields(map);
}
}
}
示例3: updateCollisionFields
import org.newdawn.slick.tiled.TiledMap; //导入方法依赖的package包/类
/**
* Metoda znajdująca pola kolizyjne
* @param map Aktualna mapa
*/
public void updateCollisionFields(TiledMap map) {
collisions = new ArrayList<>();
for (int i = 0; i < map.getWidth(); i++) {
for (int j = 0; j < map.getHeight(); j++) {
if (exist[i][j] == true) {
recField = new Rectangle(i * 32, j * 32, 32, 32);
collisions.add(recField);
}
}
}
collisions.trimToSize();
}
示例4: updateNpcFields
import org.newdawn.slick.tiled.TiledMap; //导入方法依赖的package包/类
public void updateNpcFields(TiledMap map) {
npc = new ArrayList<>();
for (int i = 0; i < map.getWidth(); i++) {
for (int j = 0; j < map.getHeight(); j++) {
if (exist[i][j] == true) {
recField = new Rectangle(i * 32, j * 32, 32, 32);
npc.add(recField);
}
}
}
}
示例5: updateMobsFields
import org.newdawn.slick.tiled.TiledMap; //导入方法依赖的package包/类
public void updateMobsFields(TiledMap map) {
mobs = new ArrayList<>();
for (int i = 0; i < map.getWidth(); i++) {
for (int j = 0; j < map.getHeight(); j++) {
if (exist[i][j] == true) {
recField = new Rectangle(i * 32, j * 32, 32, 32);
mobs.add(recField);
}
}
}
}
示例6: init
import org.newdawn.slick.tiled.TiledMap; //导入方法依赖的package包/类
@Override
public void init(GameContainer gc, StateBasedGame sbg)throws SlickException {
levelMap1 = new TiledMap("/res/hmmm.tmx");
background = new Image("/res/Background.png");
Image [] movementUp = {new Image("/res/wmg1_bk1.png"), new Image("/res/wmg1_bk2.png")};
Image [] movementDown = {new Image("/res/wmg1_fr1.png"), new Image("/res/wmg1_fr2.png")};
Image [] movementLeft = {new Image("/res/wmg1_lf1.png"), new Image("/res/wmg1_lf2.png")};
Image [] movementRight = {new Image("/res/wmg1_rt1.png"), new Image("/res/wmg1_rt2.png")};
int [] duration = {300, 300};
up = new Animation(movementUp, duration, false);
down = new Animation(movementDown, duration, false);
left = new Animation(movementLeft, duration, false);
right = new Animation(movementRight, duration, false);
sprite = right;
blocked = new boolean[levelMap1.getWidth()][levelMap1.getHeight()];
for (int xAxis=0;xAxis<levelMap1.getWidth(); xAxis++)
{
for (int yAxis=0;yAxis<levelMap1.getHeight(); yAxis++)
{
int tileID = levelMap1.getTileId(xAxis, yAxis, 0);
String value = levelMap1.getTileProperty(tileID, "blocked", "false");
if ("true".equals(value))
{
blocked[xAxis][yAxis] = true;
}
}
}
}
示例7: Camera
import org.newdawn.slick.tiled.TiledMap; //导入方法依赖的package包/类
/**
* Create a new camera
*
* @param gc the GameContainer, used for getting the size of the GameCanvas
* @param map the TiledMap used for the current scene
*/
public Camera(GameContainer gc, TiledMap map) {
this.map = map;
this.numTilesX = map.getWidth();
this.numTilesY = map.getHeight();
this.tileWidth = map.getTileWidth();
this.tileHeight = map.getTileHeight();
this.mapHeight = this.numTilesX * this.tileWidth;
this.mapWidth = this.numTilesY * this.tileHeight;
this.gc = gc;
}
示例8: init
import org.newdawn.slick.tiled.TiledMap; //导入方法依赖的package包/类
/**
* @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
*/
public void init(GameContainer container) throws SlickException {
// load the sprites and tiles, note that underneath the texture
// will be shared between the sprite sheet and tilemap
SpriteSheet sheet = new SpriteSheet("testdata/scroller/sprites.png",32,32);
// load the tilemap created the TileD tool
map = new TiledMap("testdata/scroller/map.tmx");
// build a collision map based on tile properties in the TileD map
blocked = new boolean[map.getWidth()][map.getHeight()];
for (int x=0;x<map.getWidth();x++) {
for (int y=0;y<map.getHeight();y++) {
int tileID = map.getTileId(x, y, 0);
String value = map.getTileProperty(tileID, "blocked", "false");
if ("true".equals(value)) {
blocked[x][y] = true;
}
}
}
// caculate some layout values for rendering the tilemap. How many tiles
// do we need to render to fill the screen in each dimension and how far is
// it from the centre of the screen
widthInTiles = container.getWidth() / TILE_SIZE;
heightInTiles = container.getHeight() / TILE_SIZE;
topOffsetInTiles = heightInTiles / 2;
leftOffsetInTiles = widthInTiles / 2;
// create the player sprite based on a set of sprites from the sheet loaded
// above (tank tracks moving)
player = new Animation();
for (int frame=0;frame<7;frame++) {
player.addFrame(sheet.getSprite(frame,1), 150);
}
player.setAutoUpdate(false);
// update the vector of movement based on the initial angle
updateMovementVector();
Log.info("Window Dimensions in Tiles: "+widthInTiles+"x"+heightInTiles);
}
示例9: Camera
import org.newdawn.slick.tiled.TiledMap; //导入方法依赖的package包/类
/**
* Create a new camera
*
* @param gc the GameContainer, used for getting the size of the
GameCanvas
* @param map the TiledMap used for the current scene
*/
public Camera(GameContainer gc, TiledMap map) {
this.map = map;
this.numTilesX = map.getWidth();
this.numTilesY = map.getHeight();
this.tileWidth = map.getTileWidth();
this.tileHeight = map.getTileHeight();
this.mapHeight = this.numTilesX * this.tileWidth;
this.mapWidth = this.numTilesY * this.tileHeight;
this.gc = gc;
}