public void loadFromObject() { try {
		if (cls==null) return;
		for (int i=0; i<fields.size(); i++) {
			String fieldname = (String)fields.get(i);
			String fieldtype = (String)fieldtypes.get(fieldname);
			//System.out.println("<field "+fieldname+" "+fieldvalue);
			if (fieldtype.equals("key")
			||  fieldtype.equals("int")
			||  fieldtype.equals("double")
			||  fieldtype.equals("boolean")
			||  fieldtype.equals("String") ) {
				Field field = cls.getField(fieldname);
				// if obj==null we get a static field
				fieldvalues.put(fieldname, field.get(obj));
			} else {
				System.out.println("not implemented!");
			}
		}
	} catch (NoSuchFieldException e) {
		throw new JGameError("Field not found.");
	} catch (IllegalAccessException e) {
		throw new JGameError("Field cannot be accessed.");
	} }