当前位置: 首页>>代码示例>>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;未经允许,请勿转载。