@Override public void read(Json json, JsonValue jsonData) { Iterator<JsonValue> iter = jsonData.iterator(); JsonValue value; while (iter.hasNext()) { value = iter.next(); switch (value.name()) { case "name": name = value.asString(); break; case "dir": dir.x = value.get("x").asFloat(); dir.y = value.get("x").asFloat(); break; case "speed": speed = value.asFloat(); break; case "bounds": bounds.width = value.getFloat("width"); bounds.height = value.getFloat("height"); setPosition( new Vector2( value.getFloat("x") + bounds.width / 2, value.getFloat("y") + bounds.height / 2)); break; case "score": score.read(json, value); break; } } }