A game library which enables cross-platform game development in Java, with support for Android development and desktop development. It makes use of OpenGL for portability.

learn more… | top users | synonyms

49
votes
5answers
11k views

Which image format is more memory-efficient: PNG, JPEG, or GIF?

Which image format is more efficient to save memory? PNG, JPEG, or GIF?
5
votes
5answers
5k views

Why do I get this file loading exception when trying to draw sprites with libgdx?

I'm having trouble with the "Drawing Images" section on the libgdx tutorial. I set up the documents completely and I typed the code as follows: public class Game implements ApplicationListener { ...
11
votes
3answers
13k views

Resolution Independence in libGDX

How do I make my libGDX game resolution/density independent? Is there a way to specify image sizes as "absolute" regardless of the underlying density? I'm making a very simple kids game; just a bunch ...
4
votes
5answers
10k views

What is the proper way to remove a box2d body from the world in libgdx?

I'm wondering how to remove the body from the world, because I found an error when I tried. I found following error. java: ...
5
votes
4answers
6k views

2D Platformer Collisions

I've basically asked this question before, and I know it's been asked probably a billion times, but I still can't seem to do it. All I want to know is how I should go about doing basic 4-way, ...
1
vote
1answer
418 views

Movement and rotation of bodies in top down game

We are developing a 2D top down game with libgdx using the included box2d as physics engine. We don't want our bodies to accelerate but to instantly move with the wanted velocity. The bodies are ...
6
votes
1answer
4k views

Repeat texture in libgdx

How to fill region with repeated texture? Now I'm using next method: spriteBatch.begin(); final int tWidth = texture.getWidth(); final int tHeight = texture.getHeight(); for (int i = 0; i < ...
4
votes
1answer
2k views

How can I track a falling ball with a camera?

I have been trying to get my camera to follow a falling ball but with no success. here is the code float cameraY = (FrustumHeight / 2)+((ball.getPosition().y) /2) - (FrustumHeight /2); ...
2
votes
1answer
307 views

Match-3 algorithm to fill empty space left from removing matches

I am currently creating a match 3 game. I am at the point where I have objects dropping down in the column when only one item is removed. So if an item is removed, the above item moves into its old ...
0
votes
3answers
2k views

Implementing a basic jump in libgdx

I have seen the document for libgdx and managed to move the character and also to implement bounds but the document does not show how to implement jumping. I have downloaded the superjumper demo code ...
11
votes
1answer
4k views

How can I define a complex collision area on top of a tile map?

As many people recommended, I am using Tiled map editor to create a map for my game and it's great particularly because libgdx framework also provides with API for maps from Tiled. I understand I can ...
2
votes
3answers
2k views

How do I change my gravity and jumping logic to put the character at a specific height at a specific point in time?

I'm making a 2D platformer on Android using libGDX. One thing I've had a problem with recently is gravity and jumping. I found a few tutorials on the internet and was able to come up with this... ...
6
votes
1answer
995 views

SQLite in libGDX

Does anyone have an example of how I can use SQLite in libGDX? I have a class in my original Android code that allowed me to easily access a database but I can't seem to find anything equivalent to ...
5
votes
1answer
680 views

Isometric - precise screen coordinates to isometric

I'm trying to translate mouse coords to precise isometric coords (I can already find the tile the mouse is over, but I want it to be more precise). I've tried several different methods but I seem to ...
3
votes
2answers
754 views

How do I show a minimap in a 3D world?

Got a really typical use-case here. I have large map made up of hexagons and at any given time only a small section of the map is visible. To provide an overview of the complete map, I want to show a ...
2
votes
2answers
3k views

How can I convert a tilemap to a Box2D world?

I want to use Box2D physics and lighting with a .tmx map. How can I "convert" a tilemap to Box2D world? My basic idea is to go through the tiles on the map and create an object for them in Box2D. I'm ...
1
vote
3answers
6k views

Camera Coordinate To Screen Coordinate

I want to convert the camera coordinate to screen coordinate. I have asked this question because my camera is 48m wide and 32m high but my screen is 480x320 pixels. So whatever collision point I get ...
2
votes
1answer
315 views

How to match font size with screen resolution?

So I'm working on a game using LibGDX, and I have a problem. To make my game fit most resolutions, I created a base asset for each aspect ratio, for example, a main menu background image, I made it ...
2
votes
3answers
1k views

How to force a garbage collector swep on libgdx?

I found that you can control your memory usage on libgdx with: int javaHeap = Gdx.app.getJavaHeap(); int nativeHeap = Gdx.app.getNativeHeap(); But, How can I force a garbage collector cleanup? I ...
2
votes
5answers
1k views

How to Make Objects Fall Faster in a Physics Simulation

I used the collision physics (i.e. Box2d, Physics Body Editor) and implemented onto the java code. I'm trying to make the fall speed higher according to the examples: It falls slower if light object ...
3
votes
3answers
406 views

Libgdx body passing through block then fall on it

I'm using libgdx and its physic engine Box2d. My question is : how could I make my box2d body go through a block , ignore the first collison than make the block active so the ball can fall onto it. A ...
3
votes
1answer
1k views

How do I generate mipmap .png and model .obj files for LibGDX?

I'm playing a bit with LibGDX (OpenGL ES 2.0 wrapper for Android). I found some sample code which used prepared files to load models and mipmap textures for them, e.g., at ...
3
votes
2answers
3k views

Vector images (SVG or other formats) support in libgdx or other Android framework?

I'm looking for a website to create games for Android. I'm interested in something that supports vector images. Do you know if libgdx supports them or is there a convenient way to use them in libgdx? ...
2
votes
2answers
149 views

Replicating no. of sprites without letting the app to slow down and crash

Is it possible that if I'm making a a simple drag-n-drop game, does making a new sprite via constructor with texture as a parameter makes the game slower and depletes more memory until it crashes or ...
2
votes
3answers
4k views

On screen controller for libgdx games?

Does anyone know a better controller for 2D Games than a virtual on screen joystick? The pros of the joystick are: Easy to implement for developers Familiar interface for users But there is a ...
2
votes
1answer
4k views

How do I properly implement zooming in my game?

I'm trying to implement a zoom feature but I have a problem. I am zooming in and out a camera with a pinch gesture, I update the camera each time in the render, but my sprites keep their original ...
1
vote
1answer
92 views

Restarting a libGDX game to apply changes to resolution

How can I restart a LibGDX game to apply certain changes to the game such as changes to the resolution (going from 1920X1080 to 1280X720), or changing full screen. Granted the resize(int width, int ...
1
vote
2answers
134 views

How to make an Actor follow my finger

I'm back with another question that may be really simple. I've a texture drawn on my spritebatch and I'm making it move up or down (y-axis only) with Libgdx's Input Handler: touchDown and touchUp. ...
1
vote
1answer
806 views

Why does resizing my game window move and distort my rendering?

I'm starting to make a game, and the first screen I've made is a very simple loading screen with some centered text. On starting it up, the text is nicely centered: Then I resize the window, and I ...
1
vote
1answer
1k views

Moving sprites on a graph in libGDX

In my game I'd like to move sprites on a fixed path. Until this point I was trying to stick with the tools already provided by libGDX, like the Tiled map renderer classes so I'm looking for a solution ...
0
votes
1answer
51 views

Actors (Label) not being drawn to stage [closed]

I have a weird issue that when I try to draw a Stage with only an Actor, a Label to be more precise, added to it and nothing seems to be getting drawn. This is how my setup goes: I have a Sprite ...
0
votes
2answers
78 views

libGDX map transition via try & catch exeption

I have a simple question. Some explination first, however: I am using libGDX and making a Legend of Zelda-type top-down game and I'm having an issue with map transitions. When I made the tilemap ...
0
votes
1answer
95 views

Is it possible to display no white images/sprites when using the latest Android OS?

Was it okay to use Texture.setEnforcePotImages(false) in order to disable conditional width and height pixel size that requires power of 2? I'm planning to sell the game app at Google Play. I want to ...
0
votes
0answers
15 views

time issue in render libgdx [duplicate]

pls. help how to implement this loop in render method next_game_tick and GetTickCount(); always contain same time value so player position not updated. @Override public void render() { float ...
0
votes
1answer
434 views

Input events not working simultaneously on android devices in libgdx

I am making a simple platform game in Libgdx... in which I have made the player to move left, move right and jump. The code works fine on Desktop but on Android devices, Jump is not fired when the ...
0
votes
5answers
2k views

Relationship between Desktop and Android on LibGDX

So I finished tweaking a tutorial called Rain Catcher and I ran the desktop application. It works fine. I then proceeded to run the application using the android emulator the game then crashes. I ...