So. I have a generated tile map. I want to make it so that when you make it, there will be a variable called "default_tile." I want to be able to put in a default object that will be copied and used. Until now, I just made a huge class that wen something like this:

If you have very few and very simple tiles, then enums work fine like I posted earlier. You don't need reflection to get the enum Type. Just use

Type.valueOf(String)

or

Type.values()[index]

.

Tile type also should not have any information about x/y coordinates. Why? Because a tile is just a type; either rock, sand, or grass. It isn't an entity on the screen.

In most cases you will want to store more than just "tile type" along with a tile. For example; see the following tile map:

Most of it falls under "Sand" although it can't all point to the same tile type. So your options here are to use a tile type for each tile (SandDirtTopLeft, SandDirtTopCenter, etc) -- but that gets ugly real quick. Another option is to use "traits" instead of focusing strictly on tile types. So, the sand tiles have

Trait.Walkable

, the objects might have

Trait.Blocked

, and some objects might have mutliple traights, like

Trait.SignPost

.

It quickly becomes pretty daunting to work with tiled maps, which is why it's almost always a better idea to use pre-made solutions rather than trying to reinvent the wheel. For example:http://www.mapeditor.org/

I am surprisingly 'meh' about libGDX. I mean, I would rather make my own awesome engine, that I understand completely, and will never have to troubleshoot on, than use an even awesome-er one, that will maybe be just a fad in a year, of which will take a year to fully understand. Plus, you get to say that you made an engine from scratch, and that is fun to say with truth.

Ah, but it will take you many years to make your own that is up to the same standard. Some of them spent troubleshooting. Also, libGDX isn't a fad by any means of the word.

I am surprisingly 'meh' about libGDX. I mean, I would rather make my own awesome engine, that I understand completely, and will never have to troubleshoot on, than use an even awesome-er one, that will maybe be just a fad in a year, of which will take a year to fully understand. Plus, you get to say that you made an engine from scratch, and that is fun to say with truth.

It doesn't take a long time to learn LibGDX. Maybe a month or two. Keep in mind LibGDX has been in development for years and is made up of several million lines of code.

For example; why write your own TMX loader when you can just use LibGDX?LibGDX TMX Loader

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org