• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MapObjects类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.badlogic.gdx.maps.MapObjects的典型用法代码示例。如果您正苦于以下问题:Java MapObjects类的具体用法?Java MapObjects怎么用?Java MapObjects使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MapObjects类属于com.badlogic.gdx.maps包,在下文中一共展示了MapObjects类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: loadFonts

import com.badlogic.gdx.maps.MapObjects; //导入依赖的package包/类
private void loadFonts(TiledMap data, String atlasname) {
	MapObjects objects = data.getLayers().get("preload").getObjects();
	String ffcheck = "Font";
	for (MapObject o : objects) {
		String name = o.getName();
		BitmapFont font = null;
		MapProperties properties = o.getProperties();
		String type = properties.get("type", String.class);
		String fontfile = properties.get("font_file", String.class);
		if (fontfile != null && type != null && type.equals(ffcheck)) {
			boolean markup = properties.get("markup", false, boolean.class);
			game.loadFont(fontfile, atlasname);
			game.getAssetManager().finishLoading();
			font = game.getFont(fontfile);
			fonts.put(name, font);
			font.getData().markupEnabled = markup;
		}
	}
}
 
开发者ID:kyperbelt,项目名称:KyperBox,代码行数:20,代码来源:GameState.java


示例2: loadParticleEffects

import com.badlogic.gdx.maps.MapObjects; //导入依赖的package包/类
private void loadParticleEffects(TiledMap data, String atlasname) {
	MapObjects objects = data.getLayers().get("preload").getObjects();
	String ppcheck = "Particle";
	for (MapObject o : objects) {
		String name = o.getName();
		MapProperties properties = o.getProperties();
		String type = properties.get("type", String.class);
		if (type != null && type.equals(ppcheck)) {
			String file = properties.get("particle_file", String.class);
			if (file != null) {
				game.loadParticleEffect(file, atlasname);
				game.getAssetManager().finishLoading();
				if (!particle_effects.containsKey(name)) {
					ParticleEffect pe = game.getParticleEffect(file);
					pe.setEmittersCleanUpBlendFunction(false);
					pvalues.add(KyperBoxGame.PARTICLE_FOLDER + KyperBoxGame.FILE_SEPARATOR + file);
					particle_effects.put(name, new ParticleEffectPool(pe, 12, 48));
				}
			}
		}
	}
}
 
开发者ID:kyperbelt,项目名称:KyperBox,代码行数:23,代码来源:GameState.java


示例3: loadShaders

import com.badlogic.gdx.maps.MapObjects; //导入依赖的package包/类
private void loadShaders(TiledMap data) {
	MapObjects objects = data.getLayers().get("preload").getObjects();
	String scheck = "Shader";
	for (MapObject o : objects) {
		String name = o.getName();
		MapProperties properties = o.getProperties();
		String type = properties.get("type", String.class);
		if (type != null && type.equals(scheck)) {
			String file = properties.get("shader_name", String.class);
			if (file != null) {
				game.loadShader(file);
				game.getAssetManager().finishLoading();
				if (!shaders.containsKey(name)) {
					ShaderProgram sp = game.getShader(file);
					shaders.put(name, sp);
					svalues.add(KyperBoxGame.SHADER_FOLDER + KyperBoxGame.FILE_SEPARATOR + file);
				}
			}
		}
	}
}
 
开发者ID:kyperbelt,项目名称:KyperBox,代码行数:22,代码来源:GameState.java


示例4: loadCharacterGroups

import com.badlogic.gdx.maps.MapObjects; //导入依赖的package包/类
private void loadCharacterGroups() throws IOException {
	MapLayer groupsLayer = map.getLayers().get(LAYER_GROUPS);
	if (groupsLayer == null) {
		return;
	}
	MapObjects groups = groupsLayer.getObjects();
	for (MapObject mapGroup : groups) {
		if (mapGroup.getName() == null) {
			continue;
		}
		String groupFile = mapGroup.getName();
		String id = (String) mapGroup.getProperties().get(PROPERTY_ID);
		if (id == null) {
			id = groupFile;
		}

		Vector2 position = getPositionFromMapObject(mapGroup);
		CharacterGroupGameObject group = new CharacterGroupGameObject(id, Gdx.files.internal(Configuration
				.getFolderGroups() + groupFile + ".xml"), gameMap);
		group.position().set((int) (position.x / gameMap.getTileSizeX()),
				(int) (position.y / gameMap.getTileSizeY()));
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:24,代码来源:GameMapLoader.java


示例5: loadItems

import com.badlogic.gdx.maps.MapObjects; //导入依赖的package包/类
private void loadItems() throws IOException {
	MapLayer itemsLayer = map.getLayers().get(LAYER_ITEMS);
	if (itemsLayer == null) {
		return;
	}
	MapObjects items = itemsLayer.getObjects();
	for (MapObject item : items) {
		Vector2 position = getPositionFromMapObject(item);
		PickableGameObject newItem = new PickableGameObject(item.getName());
		newItem.getOwner().set(item.getProperties().get(PROPERTY_OWNER_CHARACTER, String.class),
				Faction.getFaction(item.getProperties().get(PROPERTY_OWNER_FACTION, String.class)),
				Boolean.valueOf(item.getProperties().get(PROPERTY_OWNER_FIXED, "false", String.class)));
		newItem.position().set(position.x / gameMap.getTileSizeX(), position.y / gameMap.getTileSizeY());
		newItem.setMap(gameMap);
		newItem.setOffsets(newItem.getXOffset() + getInteger(item, PROPERTY_XOFFSET, 0) * gameMap.getScaleX(),
				newItem.getYOffset() + getInteger(item, PROPERTY_YOFFSET, 0) * gameMap.getScaleY());
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:19,代码来源:GameMapLoader.java


示例6: loadLocations

import com.badlogic.gdx.maps.MapObjects; //导入依赖的package包/类
private void loadLocations(MapLayer locationsLayer, boolean loadTraps) throws IOException {
	if (locationsLayer == null) {
		return;
	}
	MapObjects locations = locationsLayer.getObjects();
	for (MapObject location : locations) {
		String locId = location.getProperties().get(PROPERTY_ID, location.getName(), String.class)
				.toLowerCase(Locale.ENGLISH);
		String locType = location.getName();
		SaveablePolygon locPolygon = transformTiledPolygon(gameMap, getPolygonFromMapObject(location));
		GameLocation newLocation = loadTraps ? new TrapLocation(locId, locType, locPolygon,
				Boolean.valueOf(location.getProperties().get(PROPERTY_DETECTED, "false", String.class)),
				Boolean.valueOf(location.getProperties().get(PROPERTY_DISARMED, "false", String.class)))
				: new GameLocation(locId, locType, locPolygon);
		newLocation.setMap(gameMap);
		newLocation.loadFromXML(Gdx.files.internal(Configuration.getFolderLocations() + locType + ".xml"));
	}

	for (GameObject go : gameMap.gameObjects) {
		if (go instanceof GameCharacter) {
			((GameCharacter) go).calculateCurrentLocations();
		}
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:25,代码来源:GameMapLoader.java


示例7: loadTransitions

import com.badlogic.gdx.maps.MapObjects; //导入依赖的package包/类
private void loadTransitions() {
	MapLayer locationsLayer = map.getLayers().get(LAYER_TRANSITIONS);
	if (locationsLayer == null) {
		return;
	}
	Array<Transition> transitions = new Array<Transition>();
	MapObjects locations = locationsLayer.getObjects();
	for (MapObject location : locations) {
		MapObject mapObject = (MapObject) location;
		String[] coords = ((String) mapObject.getProperties().get(PROPERTY_TARGET)).split(",");
		Tile target = new Tile(Integer.parseInt(coords[0].trim()), Integer.parseInt(coords[1].trim()));

		Polygon polygon = getPolygonFromMapObject(mapObject);
		Transition newTransition = new Transition(gameMap, mapObject.getName(), target.getX(), target.getY(),
				transformTiledPolygon(gameMap, polygon));
		transitions.add(newTransition);
	}
	buildTransitionTiles(transitions);
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:20,代码来源:GameMapLoader.java


示例8: initMapObjects

import com.badlogic.gdx.maps.MapObjects; //导入依赖的package包/类
private void initMapObjects() {
	
	items = new ArrayList<AbstractItem>();
	enemies = new ArrayList<AbstractEnemy>();
	sfxSprites = new ArrayList<AbstractSfxSprite>();
	plateforms = new ArrayList<AbstractMetalPlateform>();
			
	MapObjects objects = objectsLayer.getObjects();
	for (MapObject mapObject : objects) {
		
		MapProperties objectProperty = mapObject.getProperties();									
		if (objectProperty.get("type").toString().equals("mario")) {
			mario = new Mario(mapObject);
		}
		initEnemies(mapObject, objectProperty);
		initItems(mapObject, objectProperty);
		initSfxSprites(mapObject, objectProperty);
	}
}
 
开发者ID:provenza24,项目名称:Mario-Libgdx,代码行数:20,代码来源:TmxMap.java


示例9: loadLevelObjects

import com.badlogic.gdx.maps.MapObjects; //导入依赖的package包/类
public void loadLevelObjects() {
	MapLayer mapLayerMission = getMap().getLayers().get(LAYER_MISSIONOBJECTS);
	
	MapObjects objects = mapLayerMission.getObjects();
	
	for (int i = 0; i < objects.getCount(); i++) {
		MapObject mapObj = objects.get(i);
		
		SpawnableBase base = EntityFactory.getEntity(mapObj.getName());
		if (base != null) {
			base.prepareFromMap(getLevelID(), mapObj);
		}
	}
	
	Logger.dbg("map objects loaded!");
}
 
开发者ID:Corosauce,项目名称:AI_TestBed_v3,代码行数:17,代码来源:Level.java


示例10: generateEnemies

import com.badlogic.gdx.maps.MapObjects; //导入依赖的package包/类
private Array<Goomba> generateEnemies() {
	Array<Goomba> goombas = new Array<Goomba>();
	MapLayer layer = map.getLayers().get("objects");
	MapObjects objects = layer.getObjects();
	Iterator<MapObject> objectIt = objects.iterator();
	while(objectIt.hasNext()) {
		MapObject obj = objectIt.next();
		String type = (String) obj.getProperties().get("type");
		if(type != null) {
			float x = (Float) obj.getProperties().get("x");
			float y = (Float) obj.getProperties().get("y");
			if(type.equals("goomba")) {
				Goomba goomba = new Goomba(this, x * (1/16f), y* (1/16f));
				goombas.add(goomba);
				stage.addActor(goomba);
			}
		}
	}
	return goombas;
}
 
开发者ID:arjanfrans,项目名称:mario-game,代码行数:21,代码来源:World.java


示例11: itemsInBrick

import com.badlogic.gdx.maps.MapObjects; //导入依赖的package包/类
/**
 * Check if there are items in a brick, if there are they are added to the brick.
 * @param brick
 * @param x
 * @param y
 */
private void itemsInBrick(Brick brick, int x, int y) {
	MapLayer layer = map.getLayers().get("hidden_items");
	MapObjects objects = layer.getObjects();
	for(MapObject obj : objects) {
		
		int obj_x = (int) ((Float) obj.getProperties().get("x") * (1/16f));
		int obj_y = (int) ((Float) obj.getProperties().get("y") * (1/16f));
		if(obj_x == x && obj_y == y) {
			String type = (String) obj.getProperties().get("type");
			Actor item = null;
			if(type.equals("super_mushroom")) {
				item = new Super(this, x, y, 4f);
				mushrooms.add((Mushroom) item);
			}
			stage.addActor(item);				
			brick.addItem(item);
		}
	}
}
 
开发者ID:arjanfrans,项目名称:mario-game,代码行数:26,代码来源:World.java


示例12: Level

import com.badlogic.gdx.maps.MapObjects; //导入依赖的package包/类
public Level() {
	super("Game");
	
	cam = new OrthographicCamera();
	// Setup camera viewport
	cam.setToOrtho(false, Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2);
	cam.update();
	
	batch = new SpriteBatch();
	// Load map
	map =  new TmxMapLoader().load("maps/Lvl1.tmx");
	mapRenderer = new OrthogonalTiledMapRenderer(map);
	
	// Load walls as rectangles in an array
	MapObjects wallobjects = map.getLayers().get("Walls").getObjects();
	for(int i = 0; i < wallobjects.getCount(); i++) {
		RectangleMapObject obj = (RectangleMapObject) wallobjects.get(i);
		Rectangle rect = obj.getRectangle();
		walls.add(new Rectangle(rect.x, rect.y, 16, 16));
	}
	Texture[] tex = new Texture[]{new Texture("sprites/Player_Side_Left.png"),new  Texture("sprites/Player_Side_Right.png"), new Texture("sprites/Player_Behind_1.png"), new Texture("sprites/Player_Behind_2.png"),new Texture("sprites/Player_Forward1.png"),new Texture("sprites/Player.png")};
	player = new Player("sprites/Player.png", 120, 120, walls, tex);
	wall = new Texture("tiles/Wall.png");
}
 
开发者ID:stepansubbotin,项目名称:Elementorum,代码行数:25,代码来源:Level.java


示例13: setPlayerStartInformation

import com.badlogic.gdx.maps.MapObjects; //导入依赖的package包/类
private void setPlayerStartInformation(MapObjects mapObjects) {
	if (mapObjects == null || mapObjects.getCount() != 1) {
		throw new GdxRuntimeException("Invalid map: Only one player start position allowed!");
	}

	Rectangle playerBox = ((RectangleMapObject) mapObjects.get("startpoint")).getRectangle();		
	mPlayerCell = new int[2];
	mPlayerCell[0] = (int) Math.floor(playerBox.getX());
	mPlayerCell[1] = (int) Math.floor(playerBox.getY());
	
	String healthProperty = (String) mapObjects.get("startpoint").getProperties().get("health");
	if (healthProperty != null) {
		mPlayerStartHealth = Integer.parseInt(healthProperty);
	} else {
		mPlayerStartHealth = 10;
	}
	
	// Remove fog on start position
	if (mFogLayer != null) {
		removeFog(mPlayerCell[0], mPlayerCell[1]);
	}
}
 
开发者ID:dbaelz,项目名称:Secludedness,代码行数:23,代码来源:Level.java


示例14: makeNPC

import com.badlogic.gdx.maps.MapObjects; //导入依赖的package包/类
/**
 * Create an npc object on the map
 * 
 * @param pillarNum
 *            - the pillar this npc controls
 * @param tileX
 *            - npc x pos in tiles
 * @param tileY
 *            - npc y pos in tiles
 * @param objs
 *            - the maps objects
 * @param loader
 *            - body loader to load body
 * @param world
 *            - physics world
 */
private void makeNPC(String name, boolean hasKey, int pillarNum,
		float tileX, float tileY, MapObjects objs, BodyEditorLoader loader,
		World world) {

	MapObject npc = new MapObject();

	npc.getProperties().put("x", (int) (tileX * TILE_WIDTH));
	npc.getProperties().put("y", (int) (tileY * TILE_HEIGHT));
	npc.getProperties().put("gid", NPC_ID);
	npc.getProperties().put("type", "npc");
	npc.getProperties().put("used", false);
	npc.getProperties().put("pillarNum", pillarNum);
	npc.getProperties().put("hasKey", hasKey);
	npc.setName(name);
	BodyFactory
			.createBody(world, "tile", BodyType.StaticBody, tileX, tileY);

	objs.add(npc);

}
 
开发者ID:tbporter,项目名称:Cypher-Sydekick,代码行数:37,代码来源:RandomLevel.java


示例15: makePillar

import com.badlogic.gdx.maps.MapObjects; //导入依赖的package包/类
/**
 * Create a pillar object on the map
 * 
 * @param pillarNum
 *            - the number of this pillar
 * @param tileX
 *            - pillar x pos in tiles
 * @param tileY
 *            - pillar y pos in tiles
 * @param objs
 *            - the maps objects
 * @param loader
 *            - body loader to load body
 * @param world
 *            - physics world
 */
private void makePillar(int pillarNum, float tileX, float tileY,
		MapObjects objs, BodyEditorLoader loader, World world) {
	MapObject pillarTop = new MapObject();
	MapObject pillarBottom = new MapObject();

	pillarTop.getProperties().put("x", (int) (tileX * TILE_WIDTH));
	pillarTop.getProperties().put("y", (int) ((tileY + 1) * TILE_HEIGHT));
	pillarTop.getProperties().put("pillarNum", pillarNum);
	pillarTop.getProperties().put("gid", PILLAR_OFF_TOP_ID);

	pillarBottom.getProperties().put("x", (int) (tileX * TILE_WIDTH));
	pillarBottom.getProperties().put("y", (int) (tileY * TILE_HEIGHT));
	pillarBottom.getProperties().put("gid", PILLAR_OFF_BOTTOM_ID);
	pillarBottom.getProperties().put("pillarNum", pillarNum);
	BodyFactory.createBody(world, "pillar", BodyType.StaticBody, tileX,
			tileY);

	objs.add(pillarBottom);
	objs.add(pillarTop);
}
 
开发者ID:tbporter,项目名称:Cypher-Sydekick,代码行数:37,代码来源:RandomLevel.java


示例16: loadUi

import com.badlogic.gdx.maps.MapObjects; //导入依赖的package包/类
private void loadUi(MapLayer layer, TextureAtlas atlas) {
	MapObjects objects = layer.getObjects();
	Array<String> added = new Array<String>();
	for (MapObject o : objects) {
		MapProperties properties = o.getProperties();
		Actor ui_actor = getUiActor(added, o, properties, objects, atlas);
		if (ui_actor != null)
			uiground.addActor(ui_actor);

	}
}
 
开发者ID:kyperbelt,项目名称:KyperBox,代码行数:12,代码来源:GameState.java


示例17: getCollidingMapObject

import com.badlogic.gdx.maps.MapObjects; //导入依赖的package包/类
/**
 * This method returns the properties of an object in a collision layer by checking the player rectangle and object rectangle for an intersection
 * @param layerIndex the index of the layer in which to search for objects
 * @return the collided object
 */
protected MapObject getCollidingMapObject(int layerIndex) {
    MapObjects mapObjects = map.getLayers().get(layerIndex).getObjects();

    for (MapObject mapObject : mapObjects) {
        MapProperties mapProperties = mapObject.getProperties();

        float width, height, x, y;
        Rectangle objectRectangle = new Rectangle();
        Rectangle playerRectangle = new Rectangle();

        if (mapProperties.containsKey("width") && mapProperties.containsKey("height") && mapProperties.containsKey("x") && mapProperties.containsKey("y")) {
            width = (float) mapProperties.get("width");
            height = (float) mapProperties.get("height");
            x = (float) mapProperties.get("x");
            y = (float) mapProperties.get("y");
            objectRectangle.set(x, y, width, height);
        }

        playerRectangle.set(
                playScreen.getPlayer().getX() * MainGameClass.PPM,
                playScreen.getPlayer().getY() * MainGameClass.PPM,
                playScreen.getPlayer().getWidth() * MainGameClass.PPM,
                playScreen.getPlayer().getHeight() * MainGameClass.PPM
        );

        // If the player rectangle and the object rectangle is colliding, return the object
        if (Intersector.overlaps(objectRectangle, playerRectangle)) {
            return mapObject;
        }
    }

    // If no colliding object was found in that layer
    return null;
}
 
开发者ID:johannesmols,项目名称:GangsterSquirrel,代码行数:40,代码来源:InteractiveMapTileObject.java


示例18: loadUsables

import com.badlogic.gdx.maps.MapObjects; //导入依赖的package包/类
private void loadUsables() throws IOException {
	MapLayer itemsLayer = map.getLayers().get(LAYER_USABLES);
	if (itemsLayer == null) {
		return;
	}
	MapObjects items = itemsLayer.getObjects();
	for (MapObject item : items) {
		Polygon polygon = getPolygonFromMapObject(item);
		if (item.getName() == null) {
			continue;
		}
		String type = item.getName();
		Object idValue = item.getProperties().get(PROPERTY_ID);
		String id = idValue instanceof String ? (String) idValue : null;
		if (id == null) {
			id = type;
		}

		UsableGameObject newItem = new UsableGameObject(id, Gdx.files.internal(Configuration.getFolderUsables()
				+ type + ".xml"), transformTiledPolygon(gameMap, polygon), gameMap);

		String orientationProp = item.getProperties().get(PROPERTY_ORIENTATION, null, String.class);
		if (orientationProp != null) {
			newItem.setOrientation(Orientation.valueOf(orientationProp.toUpperCase(Locale.ENGLISH)));
		}

		String groundProp = item.getProperties().get(PROPERTY_GROUND, null, String.class);
		if (groundProp != null) {
			String[] coords = groundProp.split(",");
			newItem.setGround(Integer.parseInt(coords[0].trim()), Integer.parseInt(coords[1].trim()));
		}
		newItem.setOffsets(newItem.getXOffset() + getInteger(item, PROPERTY_XOFFSET, 0) * gameMap.getScaleX(),
				newItem.getYOffset() + getInteger(item, PROPERTY_YOFFSET, 0) * gameMap.getScaleY());
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:36,代码来源:GameMapLoader.java


示例19: handleObjectLayer

import com.badlogic.gdx.maps.MapObjects; //导入依赖的package包/类
private void handleObjectLayer(int layerIndex, MapLayer layer, State state, TiledMapConfig config) {
   MapObjects mapObjects = layer.getObjects();
   for (int objectIndex = 0; objectIndex < mapObjects.getCount(); ++objectIndex) {
      MapObject mapObject = mapObjects.get(objectIndex);
      MapProperties objectProperties = mapObject.getProperties();
      GameObject gameObject = gameWorld.addObject();
      final float x = objectProperties.get(config.get(Constants.X), Float.class);
      final float y = objectProperties.get(config.get(Constants.Y), Float.class);
      final float w = objectProperties.get(config.get(Constants.WIDTH), Float.class);
      final float h = objectProperties.get(config.get(Constants.HEIGHT), Float.class);
      final float cellWidth = state.getCellWidth();
      final float cellHeight = state.getCellHeight();
      Object objectType = objectProperties.get(config.get(Constants.TYPE));
      boolean collision = objectProperties.get(config.get(Constants.COLLISION), true, Boolean.class);
      gameObject.setPosition(x, y);
      gameObject.setDimensions(IndexCalculator.calculateIndexedDimension(w, cellWidth),
            IndexCalculator.calculateIndexedDimension(h, cellHeight));
      gameObject.setLastPosition(x, y);
      gameObject.setColor(mapObject.getColor());
      gameObject.setType(objectType);
      gameObject.setAttribute(Constants.LAYER_INDEX, layerIndex);
      gameObject.setAttribute(MapProperties.class, objectProperties);
      if (objectProperties.containsKey(config.get(Constants.MOVEMENT))) {
         String className = objectProperties.get(config.get(Constants.MOVEMENT), String.class);
         RasteredMovementBehavior behavior = createMovementBehavior(className);
         if (behavior != null) {
            behaviorManager.apply(behavior, gameObject);
         }
      }
      CollisionCalculator.updateCollision(collision, x, y, layerIndex, state);
      IndexCalculator.calculateZIndex(gameObject, state, layerIndex);
      for (TiledMapListener listener : listeners) {
         listener.onLoadGameObject(gameObject, api);
      }
   }
}
 
开发者ID:bitbrain,项目名称:braingdx,代码行数:37,代码来源:StatePopulator.java


示例20: createDropOffPoints

import com.badlogic.gdx.maps.MapObjects; //导入依赖的package包/类
private void createDropOffPoints(Map map){
	logger.debug("Creating DropOffPoints");
	
	String layerName = "dropoff";
	
	//dropOffPoint map layer
	MapLayer layer = map.getLayers().get(layerName);
	if (layer == null) {
		logger.error("layer " + layerName + " does not exist");
		return;
	}

	//Layer objects
	MapObjects objects = layer.getObjects();
	for (MapObject mapObj : objects){
		
		//Object properties. 
		//name and position are set by the tiled editor. The rest are custom properties
		Vector2 position = new Vector2();
		float range = 1;
				
		MapProperties prop = mapObj.getProperties();
		Object x = prop.get("x"),
			   y = prop.get("y"),
			   r = prop.get("range");
		
		if (r != null) range = Float.parseFloat(r.toString());
		if (x != null && y != null)
			position.set((Float)x,(Float)y).scl(1/App.engine.PIXELS_PER_METER);					  
		App.engine.systems.dropoff.add(new DropOffPoint(position,range)); 	
	}		
}
 
开发者ID:Deftwun,项目名称:ZombieCopter,代码行数:33,代码来源:Level.java



注:本文中的com.badlogic.gdx.maps.MapObjects类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java InventoryUtils类代码示例发布时间:2022-05-21
下一篇:
Java PacketExtensionProvider类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap