LibGDX AStar Pathfinding on a Tiled Map - java

I want to have pathfinding in my .tmx file that created by tiled tool for libgdx but I am very biginner in libgdx. can you show me a complete pathfinding example in tiled maps with libgdx?
I use tiled for build my game map. in this grid map , I want to add node to every grid and connect with other nodes that it make us a graph to pathfinding .
like this image
How can I add nodes to tiles and connect them, and how can I run pathfinding on such a graph in libgdx?
I want some thing like this : libgdx pathfinding

Dont know if it fits your needs, but have you seen this?
https://github.com/xaguzman/pathfinding
Its well documented. Also check bridge inside it.

Related

How to detect collision between two sprites with random shapes with libgdx

I'm new to libgdx and to game development in general. I'm trying to make a 2D game with libgdx on Android. For now, for detecting collisions I was using rectangles and the "overlaps" method, it worked very well. I now want to add very specific objects into my game that are randomly generated and with various shapes like circles, stars etc..
Can you guys help me find a way to detect these kind of collisions ? I heard about Box2D, should I use that ?
Thank you very much for your help !
I believe you can use the overlaps method with any polygon. You pass it in as an array of the vertices of the object.

Semi-transparent objects in tile based rpg game

I am currently working on a simple, tile based rpg for android devices. I have stumbled across an error which I cannot solve efficiently.
Rendering Mechanics
I am currently using android's Canvas implementation to render everything in my game. I load the tile map into a bitmap using an open source TMX loader I found (not really relevant which one). The TMX loader loads the map file and produces a bitmap of the data stored in the tmx file. I am using Tiled to create my maps. The game first draws this bitmap produced by the tmx loader and then all other objects (including the player) on top of the map.
The Problem
As suggested in the title, this causes problems for semi-transparent tiles such as in this map:
The gray box is where entities collide with the well in the center of the map.
This map would be rendered like this:
The arrow is the player - part of the player should be drawn under the wooden beams of the well but still over the grass
I am struggling to find a way draw the player under the wooden beams of the well and over the grass. If anyone could give me some advice on how to do this, it would be greatly appreciated.
What I have tried
In another game I was developing, I created an object layer on tiled which would contain rectangles where the map should be drawn over the player. This worked although it caused the frame rate to drop quite a lot and it is difficult to precisely plot the rectangles over the required areas.

Animating objects inside JavaFX 2D Game

I'm going to build a simple online 2D game using JavaFX. but i have a question regarding animating graphic objects inside it . for example if a have a vector for "person" and want a move his hand only , Should i redraw many sprites for this movement ? and play an animation for replacing the image quickly ?
Almost I know that way . but what i want to know is there another way instead redrawing many images for one movement?
What i mean is there a way for moving the hand only freely for same image ? and If i'm using Inkscape and has exported the image as fx. does it help to do that ?
Your tips please , i'm new to this field
Use inverse kinematics for JavaFX for animating rigged vectors.
Use sprite animation for animating bitmapped images.
Use fbx for animating 3D models.

How do you use Tiled object layer?

I'm not really sure if this is the place to be asking this but I was trying to use the program Tiled but I'm not sure where to start. I have looked at its documentations but it's not that useful as I already have some experience in using a tiled editor in a game engine (GameMaker), but I'm working straight up Java for this project.
How does the Tiled object layer work? Does it allow me to place enemies in the tiled editor that would show up and actually move in the game or are they just static images like a tile?
Also if it does allow what I programed for the enemy how do I use it?
Tiled allows you to edit layers of tiles and items. There's tile layers which represent a 2D grid of images, and item layers which are just polygons with properties.
After you create a map, its up to you to do something with that data. Tiled is not like GameMaker. All Tiled does is allow you to read, write, and edit data.
I recommend you use LIBGDX as a game engine, and Tiled to create your maps. LIBGDX has support for loading and rendering tiled maps.
To create enemies, you'd place some polygons, add attributes to these polygons, and create enemies based on these properties when parsing the Tiled map in your game.

Tiled Editor map to optimization

I am using AndEngine to create a project game for school.
I am creating a Tiled map using Tiled. The problem i am having is that i cant figure out the size of the map it should be to fit all devices.
or is there a way to create the Tiled map to fit all screen sizes? If so please let me know.
As of now the TiledMap is to small on tablet devices and on cell phones it is to large.
Any suggestions or tutorials on this?
This is what i want to create. Not exactly like this but it is an example.
There's no built-in function for changing the tilemap resolution in Tiled.
Someone wrote a script to change the resolution of a Tiled map. This might help in making the Tilemap with two sets of graphics.
Generally speaking you should aim to support the two or three primary display resolutions. You may have to optimize the tilemaps for each resolution. An alternative would be to either display borders (assume a larger screen is as big as a slightly smaller one) or scale up the tilemap layer (that will most likely result in visual degradation). That means for the best quality you'll need to create one set of tilemap with the corresponding graphic assets for each of the device resolutions you want to support. There's nothing "automagic" about this.

Categories