Hot answers tagged

55

"Staggered" refers to the jagged edges of isometric maps that have an overall rectangular shape. These maps emphasize the north/south and west/east axes, and often have North up (example: Civilization 2). Diamond maps on the other hand emphasize the diagonal orientation and movement. North is often at the top right (example: Simcity 2000). Also ...


27

I think not overthinking this issue will give the best results so I would just implement a simple key-value saving system into your game that you store along your other save data and then load on-demand when you need to access a previous state. The flow could look something like this: Load level from file Before placing a tile / object check if it has a "...


10

I don't recommend using the "increase the dimensions and orbit in a cylinder" trick here. It has several disadvantages: More expensive to compute: Perlin noise needs to select and interpolate \$d^2\$ gradient vectors per evaluation, so going from 2 dimensions to 5 means doing 8x more work. More distortion: by evaluating it on a membrane in higher-...


6

At this time, you'd have to create an int array of the layer indexes you do want to draw, and then use the render method which takes a camera and the layer indexes. So, if you have three layers and the last one is the collision layer you do not wish to draw, you'd do: int[] layers = new int[] {0, 1}; // preferably outside of the render loop, to avoid gc ...


6

You can change it in the map properties. (Map -> Properties...)


4

First of all your sprite image needs to be part of a tileset. If your sprites use individual images, you should use Tiled >= 0.10 so that you can set up a tileset as a "Collection of Images" which you then add images to individually with the + button below the tileset view. Then create an Object Layer, select the sprite you want to insert in the tileset ...


4

Depending on how collision is implemented, the per-tile boxes may actually be more efficient (in case the bodies are in a Quad Tree most of them are easily discarded, but in the second case it may check all the edges). I think the only real way to find out is to do some testing with huge maps (I doubt you'll notice any difference with such a small map). You ...


4

Tiled doesn't currently seem to support .AI files. You need to convert it to a file format Tiled can use as a tileset source, such as .PNG. That can be done by exporting your image as a PNG.


4

Tiled does support drawing lines as collision objects. To do this, you should just not close the polygon (right-click once you're done with the polyline). In the past these have been separate tools, but in Tiled 1.2 they have been unified into a single tool. Probably the UI needs to be more clear that the tool can be used to create both polygons and ...


3

Try turning on the grid in Tiled (Ctrl+G) and adjusting your "Tile Side Length" in the Map Properties so that the grid matches correctly with your tiles. It may fix the libgdx rendering issue, and would improve the mouse picking in Tiled a little. I know setting up a hexagonal map (and even an isometric map) is somewhat confusing at the moment. It's ...


3

Haven't come across anything like that yet. But you could check GitHub for games that use Tiled. Then you can download their Tiled files and images. Here's one such repository: https://github.com/bjorn/tiled/tree/master/examples Additionally, you can also do Google searches by filetype and look for .tmx files. You might have to do a lot of searching through ...


3

When browsing the libgdx documentation (for example at http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/maps/MapLayer.html), I don't see any mention of the image layer, so most likely this relatively new (and still quite limited) layer type is not supported by libgdx yet. If you would like to see this supported in libgdx, I suggest ...


3

The usual workflow with tilemaps in Phaser is this: You make a tile map, probably in a map editor like Tiled, and export to a format that Phaser can support, like JSON. Load the tile map in Phaser. You can now draw entire layers of the map in one go - you don't have to worry about individual tiles. You can now figure out how big the tile map is by using ...


3

In Tiled you can add layers. Use a layer for the ground level, elevation1, elevation2 etc. Define a ladder/stairs tile with a property (in the tileset tile property) to indicate the player can move up or down one layer.


3

Since no other solution to this question has been posted - and I now know a solution - I figured I would answer my own question so it may be useful for others. Consider the Tiled map that looks like this: and here is the corresponding .tmx file: <?xml version="1.0" encoding="UTF-8"?> <map version="1.0" orientation="orthogonal" renderorder="right-...


3

Actually points in LibGDX are treated as RectangleMapObject with height=0.0 and width=0.0. Below debbuger output of object that is point on the tiled side:


2

From the screens it's kinda obvious, that your tiles are positioned wrong. So it seems your X axis needs to go from top-left to bottom-right and Y axis from top-right to bottom-left. Right now X goes from left to right and Y from top to bottom. Can you update your code to accommodate for that? Also your spacing between the tiles is too big, but first - ...


2

How do you expect the tile map to adapt to the screen size? If you need it to adapt in a way that requires rearranging tiles or using different map dimensions, then you won't generally get around building multiple maps. However, most commonly this is done by scaling and/or having a part of the map that is optional go out of the screen at the edges. And if ...


2

You could have an array of coordinates of collected coins, and then iterate over that and restore them when the level should be restarted. In general, for this problem you will want to keep the information around that you will still need later. You can do this either by remembering specific things explicitly or by cloning the original data.


2

The constructor of your gameScreen class does not initialize the camera and renderer fields, what you're initializing in the show method are method-local variables with the same names. That's why they're null when you're in the render method. Try changing OrthogonalTiledMapRenderer renderer = new OrthogonalTiledMapRenderer(map,unitScale); ...


2

All current implementations of TiledMapRenderer, such as BatchTiledMapRenderer, do not have the functionality to render any MapObject. You'll have to create your own implementation of TiledMapRenderer. This should get you started: public class TextureMapObjectRenderer extends OrthogonalTiledMapRenderer { public TextureMapObjectRenderer(TiledMap map) { ...


2

This is a quite known issue in box2d, the problem is that you are rendering a rectangle per Tile and in the joint of those there is a ghost vertex, you can read extensive explanation here: http://www.iforce2d.net/b2dtut/ghost-vertices As for a solution to that i solved it by creating an object layer in my tiled map and created a Polyline object that defines ...


2

If you would use the Type field instead of the Name field, then you could set a color for each type of object in the preferences. It would also autocomplete in this field for the types you have defined. But maybe a better way to make your objects visually more recognizable, especially when the size is irrelevant, is to use tile objects instead of rectangle ...


2

One thing you can do is to use multiple layers. Instead of using the Name tag of the object/collider to identify the type of the entity to be spawned, you use the layer name, so you would have Player-layer, Monster-layer, Item-layer etc (and everything in that layer is implicitly of the type specified by the layer). Then you can set the Color of the layer, ...


2

About resizing, as @bornander commented, there's a menu action for resizing that you need to use rather than directly changing the size in the Properties view. The following article is about automating the process of creating a tile map and a tileset based on an image of a map: https://github.com/bjorn/tiled/wiki/Import-from-Image As of now, Tiled can't do ...


2

This is a common problem caused by using floating point numbers for your camera movement. Occasionally, you will see the spaces between tiles. There are two ways you can counteract this: Round your camera position up to whole integers. This will make camera transitions look less smooth however. Give each tile in your tileset a padding of 1px on each side, ...


2

Instead of defining a tile-type as "blocked" or "walkable" in general, define the four edges of a tile as "blocked" or "walkable" separately (a completely impassable tile would have all edges as "blocked"). That way you can define a tile-type like that upper cliff corner which can be entered and left through the west-edge and north-edge but not through the ...


2

A common method is to have one special "Collison" layer. This is a layer which you don't draw in the game but which you use to place special tiles which say which parts of the map are walkable. Another option is to use tile properties to set the walkability for each type of tile. This has the advantage that you can just map in a what-you-see-is-what-you-get ...


2

Select the texture you have imported in the Project tab, and then in the Inspector, set Filter Mode to Point.


Only top voted, non community-wiki answers of a minimum length are eligible