object.setName(element.getAttribute("name", null)); String rotation = element.getAttribute("rotation", null); if (rotation != null) { object.getProperties().put("rotation", Float.parseFloat(rotation)); object.getProperties().put("type", type); object.getProperties().put("id", id); object.getProperties().put("x", x); object.getProperties().put("y", y); } else { object.getProperties().put("y", (flipY ? y - height : y)); object.getProperties().put("width", width); object.getProperties().put("height", height); object.setVisible(element.getIntAttribute("visible", 1) == 1); Element properties = element.getChildByName("properties"); if (properties != null) { loadProperties(object.getProperties(), properties);
/** @param name * @return the first object having the specified name, if one exists, otherwise null */ public MapObject get (String name) { for (int i = 0, n = objects.size; i < n; i++) { MapObject object = objects.get(i); if (name.equals(object.getName())) { return object; } } return null; }
MapProperties properties = object.getProperties(); String material = properties.get("material", "default", String.class); FixtureDef fixtureDef = materials.get(material); logger.info("Body: " + object.getName() + ", material: " + material);
if (o.getProperties().get(ObjectProperties.MeshScale.mnemonic) != null) { scale = Float.parseFloat(o.getProperties().get(ObjectProperties.MeshScale.mnemonic, String.class)); o.getProperties().get("type", String.class), o.getProperties().get("x", Integer.class), o.getProperties().get("y", Integer.class), scale * pixelsPerMeterFactor );
AnimatedTiledMapTile.updateAnimationBaseTime(); for (MapObject mapObject : layer.getObjects()) { if (!mapObject.isVisible()) continue; if (mapObject instanceof TiledMapTileMapObject) { batch.begin();
String type = obj.getProperties().get("type", String.class); float x = obj.getProperties().get("x", Float.class); float y = obj.getProperties().get("y", Float.class);
object.setName(element.getAttribute("name", null)); String rotation = element.getAttribute("rotation", null); if (rotation != null) { object.getProperties().put("rotation", Float.parseFloat(rotation)); object.getProperties().put("type", type); object.getProperties().put("id", id); object.getProperties().put("x", x); object.getProperties().put("y", y); } else { object.getProperties().put("y", (flipY ? y - height : y)); object.getProperties().put("width", width); object.getProperties().put("height", height); object.setVisible(element.getIntAttribute("visible", 1) == 1); Element properties = element.getChildByName("properties"); if (properties != null) { loadProperties(object.getProperties(), properties);
@Override public void onHeadHit(Mario mario) { if(getCell().getTile().getId() == BLANK_COIN) MarioBros.manager.get("audio/sounds/bump.wav", Sound.class).play(); else { if(object.getProperties().containsKey("mushroom")) { screen.spawnItem(new ItemDef(new Vector2(body.getPosition().x, body.getPosition().y + 16 / MarioBros.PPM), Mushroom.class)); MarioBros.manager.get("audio/sounds/powerup_spawn.wav", Sound.class).play(); } else MarioBros.manager.get("audio/sounds/coin.wav", Sound.class).play(); getCell().setTile(tileSet.getTile(BLANK_COIN)); Hud.addScore(100); } } }
/** @param name * @return the first object having the specified name, if one exists, otherwise null */ public MapObject get (String name) { for (int i = 0, n = objects.size; i < n; i++) { MapObject object = objects.get(i); if (name.equals(object.getName())) { return object; } } return null; }
object = new RectangleMapObject(x, yUp ? y - height : y, width, height); object.setName(element.getAttribute("name", null)); String type = element.getAttribute("type", null); if (type != null) { object.getProperties().put("type", type); object.getProperties().put("gid", gid); object.getProperties().put("x", x * scaleX); object.getProperties().put("y", (yUp ? y - height : y) * scaleY); object.setVisible(element.getIntAttribute("visible", 1) == 1); Element properties = element.getChildByName("properties"); if (properties != null) { loadProperties(object.getProperties(), properties);
/** @param name * @return the first object having the specified name, if one exists, otherwise null */ public MapObject get (String name) { for (int i = 0, n = objects.size; i < n; i++) { MapObject object = objects.get(i); if (name.equals(object.getName())) { return object; } } return null; }
object.setName(element.getAttribute("name", null)); String rotation = element.getAttribute("rotation", null); if (rotation != null) { object.getProperties().put("rotation", Float.parseFloat(rotation)); object.getProperties().put("type", type); object.getProperties().put("id", id); object.getProperties().put("x", x); object.getProperties().put("y", y); } else { object.getProperties().put("y", (flipY ? y - height : y)); object.getProperties().put("width", width); object.getProperties().put("height", height); object.setVisible(element.getIntAttribute("visible", 1) == 1); Element properties = element.getChildByName("properties"); if (properties != null) { loadProperties(object.getProperties(), properties);
String name = object.getName(); String[] parts = name.split("[.]"); RectangleMapObject rectangleObject = (RectangleMapObject)object;