當前位置: 首頁>>代碼示例>>Java>>正文


Java TmxMapLoader.load方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.maps.tiled.TmxMapLoader.load方法的典型用法代碼示例。如果您正苦於以下問題:Java TmxMapLoader.load方法的具體用法?Java TmxMapLoader.load怎麽用?Java TmxMapLoader.load使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.maps.tiled.TmxMapLoader的用法示例。


在下文中一共展示了TmxMapLoader.load方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: GameScreen

import com.badlogic.gdx.maps.tiled.TmxMapLoader; //導入方法依賴的package包/類
/**
 * 
 */
public GameScreen(SupaBox game) {
	this.game = game;
	
	//float aspectRatio = (float) Gdx.graphics.getHeight() / (float) Gdx.graphics.getWidth();
	
	camera = new OrthographicCamera();
	viewport = new FitViewport(24, 16, camera);
	viewport.apply();
	
	camera.position.set(viewport.getWorldWidth() / 2, viewport.getWorldHeight() / 2, 0);
	
	debugRenderer = new Box2DDebugRenderer();
	world = new World(new Vector2(0, -9.8f), true);
	
	mapLoader = new TmxMapLoader();
	map = mapLoader.load("crate.tmx");
	mapRenderer = new OrthogonalTiledMapRenderer(map, 1f / SupaBox.PPM);
	
	bodyBuilder = new BodyBuilder();
	bodyBuilder.createBodies(entities, world, map);
}
 
開發者ID:ryanshappell,項目名稱:SupaBax,代碼行數:25,代碼來源:GameScreen.java

示例2: initWithTMXFile

import com.badlogic.gdx.maps.tiled.TmxMapLoader; //導入方法依賴的package包/類
/** initializes a TMX Tiled Map with a TMX file */
public boolean initWithTMXFile(String tmxFile) {
 if(_tileMap != null) {
  _tileMap.dispose();
 }
 TmxMapLoader newLoader = new TmxMapLoader() {
  public FileHandle resolve(String fileName) {
   return CC.File(fileName);
  }
 };
 _tileMap = newLoader.load(tmxFile);
 _initProperties();
 _tileMapRender = new OrthogonalTiledMapRenderer(_tileMap, 1f);
 return true;
}
 
開發者ID:mingwuyun,項目名稱:cocos2d-java,代碼行數:16,代碼來源:TMXTiledMap.java

示例3: PlayScreen

import com.badlogic.gdx.maps.tiled.TmxMapLoader; //導入方法依賴的package包/類
public PlayScreen(NoObjectionGame game) {
    atlas = new TextureAtlas("dudestuff3.pack");

    this.game = game;
    bg = new Texture("main_background.png");
    gameCam = new OrthographicCamera();
    gamePort = new FitViewport(NoObjectionGame.V_WIDTH / NoObjectionGame.PPM, NoObjectionGame.V_HEIGHT / NoObjectionGame.PPM, gameCam);
    hud = new Hud(game.batch);

    maploader = new TmxMapLoader();
    map = maploader.load("map1.tmx");
    renderer = new OrthoCachedTiledMapRenderer(map, 1 / NoObjectionGame.PPM);
    gameCam.position.set(gamePort.getWorldWidth() / 2, gamePort.getWorldHeight() / 2, 0);

    world = new World(new Vector2(0, -10), true);
    b2dr = new Box2DDebugRenderer();

    new B2WorldCreator(world, map);
    hero = new Hero(world, this);
    controller = new Controller();
    worldContactListener = new WorldContactListener();
    world.setContactListener(worldContactListener);

    //timer
    sb = new SpriteBatch();
    viewport = new FitViewport(NoObjectionGame.V_WIDTH, NoObjectionGame.V_HEIGHT, new OrthographicCamera());
    stage = new Stage(viewport, sb);
    table = new Table();
    table.top();
    table.setFillParent(true);
    countDownLabel = new Label(Float.toString(playTime), new Label.LabelStyle(new BitmapFont(), Color.WHITE));
    table.add(countDownLabel).expandX();
    stage.addActor(table);


}
 
開發者ID:MissionBit,項目名稱:summer17-android,代碼行數:37,代碼來源:PlayScreen.java

示例4: PlayScreen

import com.badlogic.gdx.maps.tiled.TmxMapLoader; //導入方法依賴的package包/類
public PlayScreen(QuackHack game) {
	this.game = game;
	gamecam = new OrthographicCamera();
	gamePort = new ExtendViewport(QuackHack.V_WIDTH * 4 / QuackHack.PPM, QuackHack.V_HEIGHT * 4 / QuackHack.PPM, gamecam);
	hud = new Hud(game);
	maploader = new TmxMapLoader();

	map = maploader.load("Tunnelv0.tmx");
	renderer = new OrthogonalTiledMapRenderer(map, 1 / QuackHack.PPM);
       gameMusic = Gdx.audio.newMusic(Gdx.files.internal("Airborn.wav"));
       gameMusic.setLooping(true);
       gameMusic.play();

	gamecam.position.set(gamePort.getMinWorldWidth() / 2, gamePort.getMinWorldHeight() / 2, 0);
	world = new World(new Vector2(0, -100), true);
	//b2dr = new Box2DDebugRenderer();
	new B2WorldCreator(world, map, this);
	world.setContactListener(new WorldContactListener());
	game.getServer().registerNetListener(this);

       rayHandler = rayHandlerGenerator();

	for(Connection c: game.getServer().getPlayers()) {
		System.out.println("New Player! id: "+game.getServer().getPlayerType(c.getID()).toString());
		players.put(c.getID(), new Player(c.getID(), world, this, game.getServer().getPlayerType(c.getID())));
	}
	game.getServer().sendCommand(NetCommand.PLAYER_JOIN);

       //http://www.badlogicgames.com/forum/viewtopic.php?f=17&t=1795
       rbg = new ParallaxBackground(new ParallaxLayer[]{
               new ParallaxLayer(new TextureRegion(new Texture(Gdx.files.internal("blue_grass.png"))),new Vector2(0.5f, 0.5f),new Vector2(0, 300)),
               //new ParallaxLayer(atlas.findRegion("bg2"),new Vector2(1.0f,1.0f),new Vector2(0, 500)),
       }, 800, 480,new Vector2(150,0));

}
 
開發者ID:edwardszczepanski,項目名稱:QuackHack,代碼行數:36,代碼來源:PlayScreen.java

示例5: PlayScreen

import com.badlogic.gdx.maps.tiled.TmxMapLoader; //導入方法依賴的package包/類
public PlayScreen(MarioBros game) {
    this.game = game;
    gameCam = new OrthographicCamera();
    gamePort = new FitViewport(MarioBros.V_WIDTH / MarioBros.PPM, MarioBros.V_HEIGHT / MarioBros.PPM, gameCam);
    hud = new Hud(game.batch);
    mapLoader = new TmxMapLoader();
    map = mapLoader.load("level1.tmx");
    atlas = new TextureAtlas("Mario_and_Enemies.pack");
    renderer = new OrthogonalTiledMapRenderer(map, 1 / MarioBros.PPM);

    //set gamecam to the center at the start of the game
    gameCam.position.set(gamePort.getWorldWidth() / 2, gamePort.getWorldHeight() / 2, 0);

    world = new World(new Vector2(0, -10), true);
    b2dr = new Box2DDebugRenderer();

    creator = new B2WorldCreator(this);
    player = new Mario(this);

    world.setContactListener(new WorldContactListener());

    music = MarioBros.manager.get("audio/music/mario_music.ogg", Music.class);
    music.setLooping(true);
    music.play();

    items = new Array<Item>();
    itemsToSpawn = new LinkedBlockingQueue<ItemDef>();
}
 
開發者ID:lbalmaceda,項目名稱:libgdx_mario,代碼行數:29,代碼來源:PlayScreen.java

示例6: Ground

import com.badlogic.gdx.maps.tiled.TmxMapLoader; //導入方法依賴的package包/類
public Ground() {
    mapLoader = new TmxMapLoader();
    map = mapLoader.load("map_1.tmx");
}
 
開發者ID:MSLacerda,項目名稱:DarkDay,代碼行數:5,代碼來源:Ground.java


注:本文中的com.badlogic.gdx.maps.tiled.TmxMapLoader.load方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。