LibGDX is a cross-platform Java game development framework based on OpenGL (ES) that works on Windows, Linux, Mac OS X, Android, iOS and your WebGL enabled browser.

learn more… | top users | synonyms

3
votes
2answers
189 views

Android libGDX FreeTypeFontGenerator exception

I am working on a libGDX project for Android. Since I added the following code, running the game on my Android phone produces an exception: final FreeTypeFontGenerator generator = new ...
1
vote
1answer
489 views

How do I delete all saved preferences in my libgdx project?

I want to delete the preferences that saved my last highscore. How can I do this? Here's how I am saving preferences at the moment: prefs = Gdx.app.getPreferences("ZombieBird"); if (!prefs.contains("...
0
votes
0answers
76 views

Avoiding circular referencing using a Finite State Machine in a Component Based Architecture

While answering this question, I realised I had made the same mistake in my own code for a game I am writing using an Entity-Component System. The problem arose when I decided to use a Finite State ...
6
votes
1answer
137 views

How do I set an object's speed to arrive in X seconds?

I want to move an object to a point in the game world, I have the distance value which is far the player should move. I want to complete the movement in X seconds. I have tried many equations and ...
2
votes
2answers
215 views

libGDX Error loading font file - Netbeans

I'm trying to load a font in libGDX. But I can't figure out want I do wrong. Code: white = new BitmapFont(Gdx.files.internal("fonts/white.font"), false); Error: Exception in thread "LWJGL ...
3
votes
1answer
396 views

Steering behaviours: collision avoidance with rectangles

I'm trying to implement collision avoidance steering behaviour using rectangles. Most of the tutorials I've found are with circles, and there's a substantial difference. For example, I've been reading ...
3
votes
1answer
137 views

How to detect if two sprites are being touched at the same time?

I tried this: if(spr.getBoundingRectangles.contain(x,y)){ //do this } but how to detect if the other sprite is touched by the second pointer? Then I created two Vector3 for the pointer ...
0
votes
2answers
92 views

How do I properly load maps?

I'm trying to load my map properly, but it takes some time (after the games has been started) to be how it should. Am I doing something wrong? Why is this happening? AndroidStudio: Tiled (map ...
1
vote
1answer
25 views

Convert MathAtan2 angle to degrees

I use an angle to set the velocity (or direction if you prefer) of my sprite, however, I want the sprite to be heading in the same angle as I'm moving, rotating according to that angle. How I set ...
1
vote
1answer
274 views

Dynamic Events in an Entity Component System

My game makes extensive use of libGDX's Entity Component System Ashley, and my game world (including all levels and areas) is created with Tiled. In Tiled, I have an object layer where all of my ...
2
votes
1answer
228 views

How do I check for collision between an ellipse and a rectangle?

I am working on LibGdx framework for developing a 2D isometric tower defense game.All my sprites are drawn in 2D isometric view. I have used an array list to store 8 points at boundary in the ...
1
vote
0answers
82 views

Physics Body editor loader collision detect

In my game I use the Physics Body Editor to add custom shapes to my bodies. In my show() method I use the follownig code to create my Jetski Body: BodyDef jetskiDef = new BodyDef(); jetskiDef....
1
vote
1answer
143 views

libgdx FollowPath proper usage

I'm developing top-down rpg game and got some problems using https://libgdx.badlogicgames.com/gdx-ai/docs/com/badlogic/gdx/ai/steer/behaviors/FollowPath.html I have a path (picture 1), in this case 2 ...
0
votes
2answers
114 views

Slingshot gravity effect

I am trying to make a sling-shot that fires a projectile. I want it to act like the standard sling-shot in angry birds. So far I managed to get the "pulling" effect, ie. If I draw backwards it fires ...
1
vote
1answer
49 views

set sprite to current animation texture

In my game I have some box2d bodies where I add sprites using the following code in my render() method. for (Body body : worldBodies) { if (body.getUserData() instanceof Sprite) { ...
0
votes
1answer
109 views

Certain Unicode Characters not displaying when setting text to TextButton in libgdx

Ok I am trying to do a word game much like Hangman Pro but for a different language(specifically amharic) using libgdx . And I have got a list of words saved to text file and I have taken care of BOM ...
5
votes
1answer
314 views

AI pathfinding in mostly-free space

I'm working in an action/strategy proyect. Consider it a RTS game. The game is in 2D (with LibGDX), and I have a lot of soldiers moving along. Now I have to implement the AI. Let me say some things ...
0
votes
0answers
120 views

libgdx drawn a projectile trajectory cannot render

I am looking to draw a projectile trajectory . I found a lot of code such as : http://blog.gemserk.com/2012/07/03/drawing-a-projectile-trajectory-like-angry-birds-using-libgdx/ The code I editor; if ...
1
vote
3answers
49 views

undo touchdown in LibGDX with scene2D

i'm making a game in libgdx and i have a question. I have a Button from scene2d. If there is a touchDown event on this button, i want the touchUp event only inside my button. Now if i touchDown a ...
1
vote
1answer
83 views

My Sprite is disappearing when it collides with my floor (libGDX)

I am just starting to build the game "engine" and I am using a sprite drawn in the same position as a rectangle and the two always move together. I have another rectangle which is the floor when the ...
1
vote
1answer
81 views

Centering an animation [libGDX]

I have the following class: public class AnimationDemo implements ApplicationListener { private SpriteBatch batch; private TextureAtlas textureAtlas; private Animation animation; ...
0
votes
1answer
68 views

libGDX : Paint And Remove Color From Actor with touchDragged

I created two-dimensional array of Button actor, then I added new ClickListener() { touchDragged } as the following code: buttons = new Button[3][3]; for (int row = 0; row < buttons.length; row++...
0
votes
2answers
401 views

How to close an app correctly on desktop?

When I use Gdx.app.exit() the game window closes but the resources don't appear to be released and the app is still running. For instance, to exit on when the escape key is pressed: public boolean ...
1
vote
1answer
99 views

LibGDX Headless System.in

I started developing a little multiplayer game with LibGDX and Kryonet. I'm also using the headless backend for the server. So far everything went well, but now I'd like to create a command-line ...
1
vote
1answer
120 views

Handling multiple input mapped to single in-game controls

I am trying to map multiple input types to single in-game controls using libGDX's InputProcessor and ControllerListener interfaces. Currently, I have created a single InputType interface which is ...
1
vote
1answer
204 views

Libgdx are textures off screen rendered?

Let's say that my code looks like this: OrtographicCamera camera=new OrthographicCamera(); camera.setToOrtho(true, 100, 150); SpriteBatch spriteBatch=new SpriteBatch(); spriteBatch....
0
votes
0answers
37 views

How to detect number of pointers being used on screen?

I wan't to be able to detect if the screen is touched by two fingers at the same time. final int MAX_NUMBER_OF_POINTERS = 20; int pointers = 0; for(int i = 0; i < MAX_NUMBER_OF_POINTERS; ...
0
votes
1answer
68 views

libgdx automove Actor does not work

I am trying to make my sprite start moving from the moment it is created and do its animation. It draws on the screen right and animates but doesn't move. It should start moving towards the direction ...
1
vote
3answers
56 views

Libgdx RotateToAction does not directly rotate between 179 and -179

It took me a bit of debugging to realize why I'm having trouble with my rotations and it seems that rather than just moving the 2 degrees between 179 and -179, it prefers to rotate all the way in the ...
4
votes
1answer
130 views

On Android, How can I avoid FPS drops during sensor listener setup/tear down?

When I open my Android app after 5 or 10 seconds it sets up the sensor listener, during which I see clear stuttering and the FPS drops for a second to 40 instead of 60. Is there a way to avoid this? ...
0
votes
2answers
453 views

How to fix overly blurred texture / image in unity?

so, I'm not sure what caused this, let image below do the explanation : How to fix the overly blurred texture in unity? It's so frustrating, since I can't get it right, because when I tried it in ...
1
vote
1answer
384 views

Soft Body Collision with Box2d (libGDX)

I've made a few classes to create soft body objects in libGDX using Box2D (specifically a circle and rectangle similar to these links). The objects are constructed of a number of circle shaped Box2D ...
1
vote
1answer
127 views

Change screen dimensions in libgdx in HTML

Can i change the screen dimensions in libGDX in HTML? If I inspect the element (the game) in Chrome and I change canvas width or height it changes the screen dimensions, but I don't know how to do it ...
1
vote
0answers
102 views

Libgdx - Transparent color over texture

I am attempting to tint a texture a color but I want the texture to show under the tint. For example, I have a picture of a person but I want to tint them a light green and not change the transparency ...
2
votes
1answer
135 views

Pixel thin lines appearing between sprites on camera move

I'm going to apologize in advance for the lack of screenshots, but this was a very hard thing to capture, but very obvious to see. I'm using LibGDX to create a tile base rogue-like. Everything is ...
2
votes
1answer
53 views

Call touchUp() programattically for sprite in LibGDX

I'm trying to call touchUp() for a sprite i've created in my app. i'm getting success but the co-ordinates do not match while i call it manually. final int x = (int)mySprite.getX() + 10; final int y ...
4
votes
1answer
176 views

Is there an optimal method to implement moving background?

I am trying to develop a little game using libGDX. We have a hero who jumps and world consist of dynamically created moving platforms in an auto side-scrolling manner. I wanted background to scroll at ...
1
vote
0answers
81 views

error after changing the app name

I have made a game in Libgdx(eclipse).I changed the name of the app inside the string.xml file.Now I have an error in AndroidManifest.xml. in this line: android:label="@string/app_name"‬ (line 12). ...
3
votes
1answer
533 views

How to draw a polygon with picture in libgdx?

I'm working around a simple rectangle game, It just split the rectangle in to a lot of polygon debris. I use Pixmap and Texture to draw the edges of each polygon. ... for (GraphEdge e: _edges) { ...
1
vote
1answer
67 views

how to add “tween-engine-api” to my ilbgdx game

I finished now my first game at LibGDX (I am using Eclipse). I run the game in the desktop launcher and it works. I now want to run my game on android and IOS. From some guides I have read ,I ...
1
vote
0answers
144 views

resize images in libgdx

I know how to set Image width and height using pixel coords. Is there a way to set relative coords? I want to deal with multiple screens. For example i have 1920x1080 screen size. And i have relative ...
0
votes
1answer
16 views

libgdx: 2nd var of myClass()'s values saving to/overriding 1st var of myClass()

I'm using libgdx with Eclipse. PROBLEM: In the class inputHandler I have a list of buttons, menuButtons, composed of 2 buttons: playButton and retryButton. They both belong to the class ...
1
vote
1answer
60 views

3D mesh culling issue, further faces showing through closer faces

I'm trying to render a generated mesh using libGDX which acts as a java wrapper for openGL. The issue i'm having can be seen in the screenshot below. The faces of the mesh that should be hidden by ...
2
votes
1answer
469 views

Libgdx Networking (http requests) - Login [duplicate]

I am new to Networking and Databases, but im trying to learn MySQL and HTTP Requests to create a user Login for a game. My goal is to let users create accounts and login to them etc (for Highscores ...
-1
votes
1answer
45 views

precedurally generate blob-like surface? [closed]

Just looking for some direction, I'm making a 2d top-down game and need to make some random shapes for an asteroid surface. I want to have so control so I can have not too-circle-ish but not too-...
1
vote
1answer
285 views

Tween animation with Universal Tween Engine LIbGDX

Let me preface by saying that I'm new to libgdx... I have an animation that I'm currently drawing to the screen using: game.batch.draw(flyAnimation2.getKeyFrame(elapsedTime, true), 200,200,0, 0, 124,...
1
vote
1answer
155 views

Screenshot always returning as a white image on iOS using robovm and libgdx

I am trying to take a screenshot for sharing on social media. This code works on my Desktop project, but when I use it on iOS it always shows up as a white image, I am using the standard libgdx code ...
0
votes
2answers
94 views

score displaying system without using bitmap [closed]

how to make a score displaying system without using bitmap in libgdx. I making a fluppy bird remake somone can explaim me in details?
0
votes
1answer
31 views

Box2d java contact point reference changes after collision

I am trying to hold the contacts made during a collision in an array list. After I add n amount of contacts, when I try to retrieve them later on, they point to the last contact made in the world. ...
1
vote
0answers
113 views

Rotating, moving and scaling a mask in a shader

I want to rotate, move or scale a mask in a shader. But I have no clue to how perform these actions. My code: @Override public void create() { batch = new SpriteBatch(); background = new ...