Hot answers tagged

26 votes
Accepted

How can I implement persistent state for objects defined in a level?

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-...
Charanor's user avatar
  • 7,780
10 votes
Accepted

How can I create a six sided tillable perlin noise image?

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 ...
DMGregory's user avatar
  • 130k
4 votes
Accepted

Tiled object layer draw sprites

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....
driima's user avatar
  • 995
4 votes
Accepted

Is it cheaper to let each tile have its own collision?

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 ...
Thorbjørn Lindeijer's user avatar
4 votes
Accepted

Drawing object lines in the Tiled map editor

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, ...
Thorbjørn Lindeijer's user avatar
3 votes

Tiled height level collision

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 "...
Philipp's user avatar
  • 118k
3 votes
Accepted

Tiled height level collision

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 ...
Felsir's user avatar
  • 4,037
3 votes

How to use 16/32 square pixel tiles in tilemap on arbitrarily sized canvas in Phaser

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. ...
congusbongus's user avatar
  • 14.8k
3 votes
Accepted

Why is libGDX's HexagonalTiledMapRenderer adding extra space?

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 ...
Thorbjørn Lindeijer's user avatar
3 votes
Accepted

How to extract a point in LibGdx from Tiled map?

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:
iwek's user avatar
  • 166
2 votes

Box2D - Platformer tiled map problem

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....
Borja Clemente's user avatar
2 votes

Static spawning locations for players, creatures, items in Tiled map editor

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 ...
Thorbjørn Lindeijer's user avatar
2 votes
Accepted

Static spawning locations for players, creatures, items in Tiled map editor

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-...
bornander's user avatar
  • 4,431
2 votes
Accepted

How to integrate Tiled maps and collision detection with pygame?

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 ...
James's user avatar
  • 183
2 votes

How do I properly load maps?

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 ...
driima's user avatar
  • 995
2 votes
Accepted

How to use Tiled Editor to recreate a 2D map?

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 ...
Thorbjørn Lindeijer's user avatar
2 votes
Accepted

Texture appearing blurry

Select the texture you have imported in the Project tab, and then in the Inspector, set ...
Engineer's user avatar
  • 29.3k
2 votes
Accepted

How should I manage Roguelike levels/maps in JavaScript?

I see nothing fundamentally wrong with your approach. Just a few thoughts: Map is a pre-existing javascript data type. So unless the code in your answer actually ...
Christoph's user avatar
  • 241
2 votes

Take an image and cut it up into a tile map

Take a look at Tiled. It's a tool for creating 2D tile maps including hex-based maps like the example in your post. Phaser allows you to load tile map data generated by this tool. Once you've created ...
JRR's user avatar
  • 21
2 votes
Accepted

How do you use these kind of rpg ground tileset ?

This tileset is famous because it was used in RPG maker VX. It seemingly consists of 6 tiles (2 by 3) and it even outputs tiles in that size, but it actually handles the tileset as if it was 4 by 6: ...
Bálint's user avatar
  • 14.8k
2 votes

Segmentation Fault using Allegro_Tiled, function al_open_map();

Looks like you are not initializing the library with al_init call. It tries to retrieve some standard directory to know where is the map stored, but crashes ...
michalsrb's user avatar
  • 166
2 votes
Accepted

Tiled tmx format into 3d Texture

You can create a mesh programmatically that corresponds to a tmx tilemap. A tilemap consists out of two things: the tilemap and the texture. I know the TMX format is not immediate in X,Y coordinates,...
Felsir's user avatar
  • 4,037
2 votes
Accepted

Finding equivalent axial coordinates for a wrapping hexagonal map of radius n

I figured it out. For anyone else in the future I followed the posts by Sander Evers that amitp suggested (thanks both of you), just the small_to_big and center_of functions in combination will give ...
Knackname's user avatar
2 votes
Accepted

Tiled Map Editor Vs Text File? | Pygame

My suggestion would be to do both: Start by just following the tutorials and using the text file. This will give you a nice way of getting your head around what's going on in the code, and how you ...
Phil S's user avatar
  • 311
1 vote
Accepted

Love2D and 'Tiled' - Detect if player is over certain tile/Collision

Indexing a 2D array represented as a 1D array is done like this: index = x + y * width Where width is sometimes known as ...
congusbongus's user avatar
  • 14.8k
1 vote

How do I incorporate .tmx files into my game?

The easiest way to parse TMX files with Java is to use the libtiled library. It is licensed under 2-clause BSD, which means you can use it for anything as long as you give credit. But if you would ...
Philipp's user avatar
  • 118k
1 vote

How do I incorporate .tmx files into my game?

I'd suggest taking a look at the following classes from the LibGDX framework- TiledMap, TMXMapLoader and MapRenderer. I found a decent tutorial here with example code for reading in and rendering a ...
David Greaves's user avatar
1 vote
Accepted

Top down tile based game render order

When you want to have overlapping sprites in your game, you need to put them in a list which you sort by the coordinate of the lower edge of each sprite and then render them in that order. Further, ...
Philipp's user avatar
  • 118k
1 vote

Pathfinding: grid based map of irregular numbered tiles to mark connections

Instead of having Id numbers you can assign a cost value to each tile based on the state of the tile. For example : if tile has enemy then give it cost value of 10000 and if there's a loot box then ...
Ankit singh kushwah's user avatar

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