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

50
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?
15
votes
2answers
26k views

Where are all the tutorials for libGDX? [closed]

I've searched online for help and tutorials on LibGDX but I couldn't really find any, except and the wiki for asking questions on stackexchange. Besides the source (demos) and wiki, is there any other ...
15
votes
2answers
955 views

Graphics not being displayed on OUYA

I hope its not too early to be asking OUYA dev questions, but I just got my dev kit and I want to get my game running ASAP! I am using LibGDX as my framework for my game and launching the Android ...
13
votes
3answers
1k views

What libgdx project files can I ignore from version control?

In an automatically created libgdx project, what files can I safely tell Git (or other revision control systems) to ignore? I'm considering these: *-android/.settings/ *-android/bin/ ...
12
votes
2answers
4k views

Play videos with LibGDX

Is there a way to play videos with LibGDX? I want to put a video as my splash screen in Android, but I dont want to use the Android SDK, because I am using LibGDX and I am almost finished :/
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 ...
11
votes
4answers
8k views

How do I make an on-screen HUD in libgdx?

I'm new to libgdx, and I am finding I am getting stumped by the simplest of things. It seems to want me to do things a specific way, but the documentation won't tell me what that is. I want to make ...
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 ...
11
votes
2answers
2k views

How do some mobile games scale graphics so beautifully? [duplicate]

I'm working on my first Android game and have been struggling a bit with scaling. I've got 3 test devices 800x480, 1920x1080 and a 2560x1600 tablet. Some games look near perfect on all of them - many ...
10
votes
2answers
818 views

How well do functional languages perform on Android?

This is a special case of this question that I feel is particularly pertinent. I'm working on a game for Android, and I'm planning on using Scala with libgdx. I'm planning on making a performant ...
8
votes
2answers
405 views

How can I implement a scanline effect?

I am working on an old-school platformer in libgdx and I want it to have a "scanline" effect, like this: My first attempt was to make a little texture and draw it on a full-screen quad. I used two ...
7
votes
4answers
1k views

Making a Box2D ball bounce to constant height

I want to create a game like Doodle Jump. I'm using libgdx and Box2d. I needadvice on how to make my ball bounce constantly and with the same height. I've tried setting the ball's body restitution ...
7
votes
2answers
3k views

LibGDX - Check if currently on Android/Desktop

I'm using LibGDX and flixel-android to build a Desktop/Android game. It feels like there should be a way of checking to see if you're currently being run on an Android device, the Desktop, and so on, ...
7
votes
2answers
715 views

How can I make a snake's tail follow the head?

Following an assignment and just getting started with libGDX by building a small Snake clone I've run into an issue that I'll probably be ashamed for in a little while. I currently have a snake's ...
7
votes
3answers
6k views

Advantages and disadvantages of libgdx [closed]

I've been an android developer for a while and am thinking about getting into gaming. While looking for a game dev framework, I thought libgdx provides very friendly documentation and functionality. ...
7
votes
1answer
232 views

Problem when scaling game screen in Libgdx

Currently, I'm able to scale the screen by applying this bit of code onto an OrthographicCamera Camera.setToOrtho(true, Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2); But something ...
7
votes
1answer
2k views

How to force a line break before the last word of a line reach the edge?

I'm printing a sliding text by adding each letter after a short period of time. My problem is that when the text multilines, the last word of a line starts on the current line and jumps to the next ...
6
votes
3answers
933 views

Understanding how to create/use textures for games when limited by power of two sizes

I have some questions about the creating graphics for a game. As an example. I want to create a motorbike. (1pixel = 1centimeter) So my motorbike will have 200 width and 150 height. (200x150) But the ...
6
votes
1answer
5k views

Is libgdx fit for 2D game development on Android or are there simpler alternatives?

I'm looking for a Java framework to develop 2D games on desktop and Android. I've looked at Slick and I really like the API, however the developer himself says if you want a framework for Android and ...
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 < ...
6
votes
1answer
1k 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 ...
6
votes
2answers
3k views

How can I post scores to Facebook from a LibGDX Android game?

I am using LibGDX to create an Android game. I am not making the HTML backend of the game. I just want it to be on the Android Google Play store. Is it possible to post the scores to Facebook? And if ...
6
votes
1answer
1k views

Generating a physics body for 2D Worms-like Terrain

I wrote a processing sketch that generates hills for a scorched earth clone, like this: I'm trying to figure out how to make this a physics object in libgdx, but I'm having problems figuring out ...
6
votes
1answer
1k views

Weird error with opengl in Android using Libgdx : “EGL_BAD_ATTRIBUTE”

I am having a weird error when uploading my game in the phones. E/Adreno200-EGL(5128): qeglDrvAPI_eglGetConfigAttrib:484>: EGL_BAD_ATTRIBUTE I am uploading the textures with AssetManager. I am ...
6
votes
3answers
3k views

How do I render a PNG with transparency in LibGDX?

I'm building a simple tic-tac-toe example with LibGDX. I have simple images: cross, circle and board, all pngs created with GIMP with a transparent background. How can I render them as a Texture with ...
6
votes
1answer
1k views

How can I achieve smooth shading / glow from one tile to another?

I've been working on a tile-based game in which some areas may be lit (currently seen), some may be black (never seen) and some may be dark (previously seen, but not currently seen). Looking at the ...
6
votes
1answer
855 views

What methods should save/load a game state

There are a lot of articles about how to save a state of a game and they are pretty good. But I have one conceptual misunderstanding where should I save the state? My game has number of screens and ...
6
votes
0answers
293 views

Box2D strange collisions (jitter) on sharp edges [closed]

I'm currently developing 2D side scroll game with Libgdx + Box2D. And I'm facing some problems with ChainShape (the ground) and PolygonShape (the cart body) collisions. Please look at this video: ...
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 { ...
5
votes
3answers
7k views

Changing the color of a sprite at runtime

Is there a form to change the color of a sprite in runtime?} I have a black point loaded with an image, but i dont want to load various images with different colors, is there a mode to change the ...
5
votes
3answers
11k views

LibGDX tutorial help Scene2D

I'm having trouble understanding this tutorial. It defines the importance of classes, but it doesn't show an outline of the project file so far. From what I got from that tutorial was that there is ...
5
votes
2answers
872 views

Is it legal to pack LibGdx libraries in my jar file? And to obfuscate them?

I'm using LibGDX and deploying a runnable jar file, using the Eclipse feature, with libraries extracted into it. There are also .so files and .dlls inside. 1 . Is it legal to do so? I didn't find ...
5
votes
3answers
601 views

Creating Platform game with Inclined Levels

Till now I have developed platform games in which a player can only move and detect tiles linearly. I wonder on how to implement games in which a player can move on an inclined or irregular surface. ...
5
votes
2answers
171 views

How to make part of the Texture not to be scaled.?

I am new to LibGdx, i was doing one example for my learning and struck with this question, i had searched in google but i am not able to find the answer for this. 1) How to make part of the Texture ...
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, ...
5
votes
1answer
3k views

Box2D Difference Between WorldCenter and Position

So this problem has been brothering for a couple of days now. First off, what is the difference between say Body.getWorldCenter() and Body.getPosition(). I heard that WorldCenter might have to do ...
5
votes
1answer
529 views

OpenGL ES 2.0 obscured texture is visible

Hi, I am using LibGDX and OpenGL 2.0 to create a game. So far I have created two meshes. The front mesh is the one with the brown circle texture and another mesh on the top with a green to white ...
5
votes
1answer
1k views

How To Correctly Extend the Sprite Class in LibGDX

I am currently pursuing game development as a hobby, and have run into what seems to be a conflict in my mind regarding how to properly (using best practices) extend the Sprite class in LibGDX (or for ...
5
votes
2answers
2k views

Detect if a sprite has left the camera in libgdx?

Is there a method to know if a sprite has left the camera of the stage? or I have to do my operations? :P
5
votes
3answers
2k views

Libgdx optimization of big arrays

I am working on a game using libgdx and I have the following code that I want to optimize. Array<Bullet> enemyBullets = Enemy2.getEnemyBullets(); for (Bullet bullet : enemyBullets) { ...
5
votes
2answers
341 views

Running multiple box2D world objects on a server

I'm creating a multiplayer game using LibGdx (with Box2d) and Kryonet. Since this is the first time I work on multiplayer games, I read a bit about server - client implementations, and it turns out ...
5
votes
1answer
698 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 ...
4
votes
5answers
11k 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: ...
4
votes
4answers
789 views

More efficient in range checking

I am going to use a specific example in my question, but overall it is pretty general. I use java and libgdx. I have a ship that moves through space. In space there is debris that the ship can ...
4
votes
1answer
3k views

sprite display does not match its body in box2d

I found about this using debug renderer. When game starts, everything is in order. But when some collision happens, sprite's rotation is way larger than its body. When sprite and body match is the ...
4
votes
1answer
5k views

How to use particle editor for libgdx?

In the libgdx wiki, this particle editor is recommended. And this blog was helpful. But the problem is that I am not sure yet how to use it for my game. Let's say I want to have a fire-effect in my ...
4
votes
1answer
848 views

Why doesn't my android application rotate when I rotate my screen

I am building a game in LibGDX and the game screen orientation is in landscape. I want it to stay in landscape but I still want the user to be able to flip the device onto the other side and the ...
4
votes
1answer
2k views

Libgdx sprite rotation (image quality)

This one is probably really simple but I didn't find a solution. I'm trying to create a widget (speedometer) with libgdx. For the arrows I'm using the setRotation() function. But when the image is ...
4
votes
2answers
1k views

Bitmap Font Displays in Center Always Without Coding it Manually (Fix Coordinate Problem onText)

Is there a way on how to stay the texts in center without manually coding it or something, especially when making an update? I'm making a display for the highest score. Let's say that the score is 9. ...
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); ...