Tag Info

New answers tagged

6

This is a basic connected components problem, and can be solved with a single invocation of breadth-first or depth-first search, or any flood-fill algorithm. bool IsOneSolidShape(TileCollection tiles) { // Clear visited flags on all tiles. // (This can also be implemented as a temporary set/map or parallel array, // if you prefer not to clutter ...


0

It sounds like all you are looking for is to see if there are ANY broken edges in your tiles and get a true or false back. If that is the case, all you need to do is look at every place tiles join together (on the x axis and the y axis) and see if the edges are compatible. You'd loop until you either found a broken edge (and you'd return true), or until ...


3

Record the vertexes as lines on the edges where a shapes points lie. These will be used to match up to points/lines on the other tiles each time a tile changes. For example: Above the blue lines on the top two tiles, A and B, have been calculated/saved for each edge of the tile according the shape it contains (note even though they are on different sides ...


0

If I understand your question correctly, you are trying to find the center of the hex cell to which an arbitrary point belongs. Your question made me think of Voronoi diagrams... I have a gut feeling that they might be relevant here, though other solutions might have a better performance. (This solution might be wrong too, but I feel like it could be ...


0

I'm not totally sure I understand your question. You are having trouble converting a position into a hexagon coordinate? If so I did some research on turning a vector position into a hexagon coordinate that might help you out. But first of all I highly recommend this website for general hexagon coordinate information: ...


0

There are documents in libGDX's github wiki https://github.com/libgdx/libgdx/wiki/Tile-maps According to this page, you can get your objects by finding the layer contains them. MapLayer layer = map.getLayers().get("my-layer"); Find your objects MapObjects objects = layer.getObjects(); And get the object objects.get("object_name"); There are many ...


3

Here are the areas your nearest function associates with each tile: (assuming float % int is performed as a floating point modulo in your environment. If not, you can get broken/offset tiles instead, as visualized in the third image above) As a unit travels down and to the left, they briefly touch the stretched/offset corner of the tile below and to the ...


8

Tiles and icons (even in UIs like window systems) are often in a size like 16x16 or 24x24 to make it easier to modify the tiles. Most times the tile size is a multiple of 8 because of the folowing reasons. It is relatively easy to shrink a tile with the size 32x32 to 16x16 by simply putting 4 pixels together (e.g. create the median/average of the 4 ...


0

Here is my working AStar implementation built in Java on the LibGdx framework (it should not be too difficult to adapt to C#): public class AStar { /** * Makes the end passable, if it wasn't already, and then finds the shortest path towards it, using the AStar algorithm. * @param start The node to start the search from. * @param end The ...


1

It seems you may have misunderstood the purpose of Tiled or tilemapping in general, so maybe I could clarify a bit for you. In simple terms, a tilemap is an array values that you use to construct your stage from an image (the tileset). It basically tells your code which part of the image to draw on the game screen. This way, you can reutilize your assets ...



Top 50 recent answers are included