Dynamically create a public variable Java -
i making game. in game, there class called "tile" has list of tiles in format:
public static final tile <tile_name> = new basictile<basicsolidtile>(id, spritesheetx, spritesheety, 0xffcolorinmap, isbackground, isliquid);
one of main aspects of game ability "mod" @ (there mod.smf file has declarations of modding). in file, create new tile this:
--tile-- basictile/basicsolidtile <name>: x,y,hexcolor,<background/foreground>,<notliquid/liquid>
the id calculated in code.
i wondering how create more "public static final tile's" in tile class using loop running through new tiles in mod file. possible, or have change how tile's stored (an arraylist instance?)?
your task impossible.
you can't add field class in runtime code.
instead of request have change solution take tiles.
that can type of collection. have analyze best usage , decide further use.
best luck.
Comments
Post a Comment