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

0
votes
1answer
344 views

LibGDX: Colllisions between bullets and enemies in arrays

I am writing a "Gauntlet" style game. So far I have managed to successfully detect collisions between my player object and my ghost enemy objects, and when they collide they drain the player's energy. ...
3
votes
1answer
94 views

Custom Coloring of Tileset Characters

Games like Dwarft Fortress and Dungeon Crawl Stone Soup are drawing their boards using tiles from a tileset image (I think?). I know you can do color keying and replace the background color with ...
1
vote
1answer
122 views

LibGDX: How to detect remote button press for Android TV?

On Android TV, I need to be able to detect the remote control centre button to start the game. I tried: if (Gdx.input.justTouched() || Gdx.input.isKeyJustPressed(Input.Keys.SPACE) || ...
1
vote
2answers
660 views

Libgdx box2d crashing

im making a game in libgdx which i having a bunch of circle bodies floating around in space and when the player's body crashes into another body, that body deletes and creates two smaller bodies ...
1
vote
1answer
1k views

libgdx sprite position relative to body

Apologies if this is a reiteration, as I couldn't find another discussion of this over the past couple days. Issue: I'm using libgdx and box2d, and I'm currently updating the sprite's position to ...
0
votes
1answer
26 views

libgdx collision on moving Rectangle with other Rectangle

I'm making a soccer game where you touch the screen and the player shoot the ball to the touched position with the objective of scoring goals when it hits the goal. The player is just a Sprite and the ...
1
vote
1answer
40 views

How to rotate an image on touch using RotateToAction in libGDX?

I want to rotate my image on touch but it never applies action, I'm using RotateToAction to achieve this. class actorCark extends Actor { Texture texture; Sprite sprite; Global g; ...
1
vote
1answer
87 views

libGDX upload z-axis of sprite to graphics card

Background: I want to obtain each fragments position via vertex interpolation to then calculate the light vector for phong shading (L = [Fragment pos] - [light source pos]). Problem: At the moment I ...
0
votes
0answers
14 views

Unable to rotate an Actor using an Action in libgdx; what am I doing wrong?

I use this to add a rotate action to my actor: theme_button = new ThemeButton(theme); theme_button.setPosition(300, 300); theme_button.setSize(300, 300); ...
0
votes
1answer
44 views

Libgdx: move img from one point to another?

I'm trying to make an image move towards another point. I only have the current X/Y and the destination X/Y + Speed. That's it. public void Draw(SpriteBatch batch, int goalX, int goalY){ destX = ...
4
votes
2answers
174 views

How do I induce collision events in LibGDX 3D?

In the code below I've put an example of something I want to do. I have the camera and I want it to stop moving whenever it hits one of the boxes, how do I do this? public class Main extends ...
0
votes
1answer
52 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; ...
4
votes
1answer
304 views

LibGDX Box2D TileGame Efficiency

I am trying to implement Box2D into my top down tile game in LibGDX. Each world consists of a set of chunks, and each chunk is 16 tiles wide/long. The maximum/minimum chunks loaded at one time is 9 (a ...
1
vote
1answer
42 views

Shader only rendering 1/4th of the screen

I've asked the same question on SO here and they suggested I should ask here instead. I'm currently trying to create a gaussian blur shader, and while I've successfully created the blur effect my ...
0
votes
1answer
22 views

libgdx sprite placement

Im making a soccer game where you basically have to shoot the ball to the goal and the ball goes to where you touch the screen. Im having an issue with the ball though, when the ball spawns on the ...
1
vote
1answer
234 views

Rotating towards a point in Box2D

I'm using Box2d as my physics engine and I'm trying to solve what would normally be a simple problem but what has become a nightmare for me and preventing me from finishing my app. (6 months work) ...
0
votes
1answer
277 views

How to use Java 8 with Lib GDX in IntelliJ?

I have set the jdk to Java 8 and I have modified all the build.gradle files in my project to have sourceCompatibility = 1.8 instead of 1.6. My problem is that while it does work on Desktop it doesn't ...
0
votes
1answer
49 views

How to split a screen in half using LibGDX without scaling?

I am currently working on a racing game with libGDX and I need to split the screen in half for a two-players mode. (Player 1 in first half and Player 2 in second half). I already have Camera1 that ...
0
votes
1answer
103 views

Black screen when launching on phone

I am coding a game in libgdx. While adding the background I used the html module to watch the results fast and easy on my computer. But when I try to see it on my phone I just get a black screen. My ...
2
votes
2answers
311 views

Laggy empty project at 60FPS

@Override public void create() { batch = new SpriteBatch(); img = new Texture("badlogic.jpg"); } @Override public void render() { Gdx.gl.glClearColor(0, 0, 0, 1); ...
4
votes
2answers
237 views

How to achieve sprite reflection effect in libgdx

I am currently working on an open world game similar to Pokemon using libgdx. I am currently stuck on this effect that I really want to be done before moving to other features of my game. How can I ...
1
vote
1answer
99 views

Libgdx: Check collisions in Stage among actors

My goal is to check collisions among the actors that are in the Stage. My question is: is it necessary to maintain a list for each type of actor I have? Doing that I get 3 problems, 2 bad design ...
1
vote
1answer
255 views

libGDX new TextureAtlas(filename) and new Texture(filename) drawing stale image data

I'm trying to draw an image using libgdx but no matter what I do, libgdx seems to insist on drawing a portion of an image I had loaded and used in an earlier game screen. In my current game screen ...
1
vote
1answer
236 views

Sprites are rendered as black rectangles in android 4.0.x only

I have some problems rendering sprites correctly on a LG optimus vu (android version 4.0) with libgdx. Basically sprites are black rectangles, while other images that i declare as Texture are correct. ...
0
votes
1answer
33 views

Setting resizable to false in LibGDX

I have a small working game prototype. I want to do something like LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration(); cfg.resizable = false; But I get ...
-1
votes
0answers
13 views

On touch input Libgdx [duplicate]

I want to have an on hold or on touch input for my game. So as long as the user touches the screen something happens (a car moves) and when he stops touching the screen it stops. How do I do that
-1
votes
0answers
59 views

Implementing gesture detection in LibGdx

what I tried: public class PlayState extends State implements GestureDetector.GestureListener { private Protagonist bird; private Texture bg; GestureDetector gestureDetector; ...
3
votes
1answer
109 views

Scene2D Actor walking animation?

I used to extend my Player/Entity class with Sprite, that way I could create a walking animation using SetRegion and super(stilldown.getKeyFrame(0)); I've recently started porting everything over to ...
1
vote
1answer
38 views

Libgdx, actor touchlistener not working

public class Main extends ApplicationAdapter { SpriteBatch batch; OrthographicCamera camera; Stage stage; Image greyback; Image circle; private float width; private float height; @Override ...
3
votes
1answer
142 views

Creation of a tiled map editor polyline in box2d is not working correctly

I'm currently trying to create a box2d polyline object in my libgdx game, but it's not working as expected. To get a better picture of my subject, have a look at how it should look like, and how it ...
7
votes
2answers
2k 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
1answer
171 views

How to detect collision only in non-transparent texture?

I am developing a game using libgdx. I am trying to detect the collision between bee and tube. I am using the following code to detect the collision. if(player.getBounds().overlaps(boundsBot)){ } ...
0
votes
1answer
232 views

How to zoom and scroll in libGdx?

I am trying to both A.) Pinch zoom my game scene and B.) Move (scroll) my game scene but I have not found many examples. I learn more by examples than by reading API documentation (although I am ...
0
votes
2answers
74 views

Round position to center of current grid position

The title may not make sense, nor may the question - I'll try nevertheless. I'm attempting to make a game similar to The Powder Toy. Essentially, this is a physics simulation game, where the users ...
0
votes
0answers
142 views

Box2dMapObjectParser isometric map - bodies have wrong position and size

I'm using Box2dMapObjectParser to load Tiled objects layer onto my IsometricTiledMapRenderer'ed TiledMap. It works OK with a UnitScale of 1 but the position is wrong and some shapes have weird ...
0
votes
1answer
28 views

LibGDX: Transition scale bitmap font

I'm trying to create a Minecraft like quotes on the menu screen of my game. I'm using BitmapFont to draw the text on screen but i don't know how to make that scale up scale down effect. This is what ...
1
vote
1answer
71 views

How to handle two players playing on one keyboard with Box2D (LibGDX)?

I'm making a racing game with LibGDX and Box2D. I've been using this tutorial to implement the basic physics, and it works properly. My main problem is to implement two different sets of keys ...
1
vote
0answers
31 views

How to force libGDX to set display mode?

The following code represents my attempt to switch display modes. I've had to include the redundant setWindowedMode because without it, libGDX would not force the change required to reflect the ...
6
votes
3answers
3k views

LibGDX keep camera within bounds of TiledMap

I have a simple TiledMap which I can render fine. I have a player hopping (with Box2D) around and my camera follows the player around: cam.position.set( player.position().x * Game.PPM + ...
0
votes
1answer
23 views

TiledMap renders but gets duplicated when I move the camera

I've created a map (TMX file) using Tiled, imported it and it shows great but when I move the camera, it duplicates itself and the whole screen flickers. In Tiled, I didn't use a spritesheet but ...
1
vote
1answer
97 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
912 views

Changing Box2D Body from Kinematic to Dynamic after contact

What is the correct way to change a Kinematic body into a dynamic body? context - I have a dynamic body as a projectile which has to be fired at a kinematic body (it is kinematic because i am ...
0
votes
0answers
10 views

Libdgx and Overlap2D export settings for Android

So I have a problem when exporting assets from Overlap2D to Android Studio project location. When setting up libgdx I set the project to be for desktop and android and selected Overlap2D extension. ...
0
votes
1answer
544 views

libgdx ActorGestureListener.pan() parameters not moving actor in smooth line

I override the pan method in ActorGestureListener to implement dragging actors in libgdx (scene2d). When I move individual pieces on a board they move smoothly, but when moving the whole board, the ...
2
votes
4answers
247 views

How to make sure that when two bodies collide, there is only one collision detection on box2d?

I'm using LibGDX with Box2D and, when two bodies collide, the collision is detected multiple times. Here's the code: public void preSolve(Contact contact, Manifold oldManifold) { Body a = ...
2
votes
1answer
106 views

Get array from JSON in Libgdx?

I wanted to load in map information using JSON, is there a way to get String, Int, float etc lists or arrays from JSON in Libgdx? My structure looks like this { "data": [{ "name": ...
2
votes
1answer
79 views

LibGDX How do I create a Shop? [closed]

My game is fully working but now I want to make a shop so that the player can buy boosts or other useful stuff for the money the player has collected. What is the best way of doing this kind of ...
1
vote
1answer
65 views

ScreenSize vs. WorldSize

While programming a game with LibGDX, I came across a problem. My OrthographicCamera wasn't centering in the right place. I was trying to center the camera by using the line of code: ...
0
votes
2answers
596 views

Can't work with universal tween engine while having added it to gradle

I'm actually developing a game with libgdx and I'd like to create a splash screen. To do this, I must use the Universal Tween Engine. To add the Universal Tween Engine, I followed the instructions of ...
3
votes
2answers
1k views

Matrix rotation wrong orientation LibGDX

I'm having a problem with matrix rotation in libgdx. I rotate it using the method matrix.rotate(Vector3 axis, float angle) but the rotation happens in the model orientation and I need it happens in ...