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
0answers
19 views

Actions.fadeOut doesn't work when called on stage root

I'm trying to fade out my screen when a button is pressed, but the following code doesn't work: public void switchScreen(final Game game, final Screen newScreen){ stage.getRoot().getColor().a ...
2
votes
1answer
130 views

How can I draw multiple lines connected via “nodes” in libgdx Scene2D?

I have two Vectors which indicate the ending points of each line. I am trying to draw similar lines to football formation lines like these. My main problem using ShapeRenderer is: ShapeRenderer ...
0
votes
0answers
21 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); theme_button.setOrigin(theme_button.getWidth()...
0
votes
1answer
33 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 ...
2
votes
1answer
55 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
28 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
votes
1answer
59 views

onHold input libGDX

I want to have onHold or onTouch 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? I want ...
1
vote
0answers
60 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 ...
0
votes
0answers
28 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. ...
1
vote
1answer
83 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: gameCam.position....
0
votes
0answers
6 views

LibGDX Child node is not following animation

So I'm trying to place a golf club as a child node of the hand of our "golfer", so it follows the animation the golfer has when the animation is invoked. However, once I hit "Check Swing" (the button ...
0
votes
1answer
77 views

Network interpolation wont work for local player

im currently developing a little duengon crawler. It should have lan multiplayer and it works great but i think im sending to much packets. Should i send packets over network, when a player moves in ...
1
vote
0answers
174 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
88 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
0answers
68 views

How to update projectile trajectory point?

I am a new game developer, I am making a game, but I have a problem, I don't know how I can update my trajectory point in OnDraw method. Could anyone please help me? Thank you! Here is my code: ...
1
vote
0answers
83 views

Libgdx stops all sounds when there are lots of sounds

I'm making a 2D game for Android using Android Studio with Libgdx in Java. I have a class, called SoundPlayer, which holds an ArrayMap. The key is the name of the sound file and the value is the sound ...
0
votes
1answer
26 views

InputProcessor without stage

I have a GameScreen where I'd like to have a pause button. I've tried using an Image with a listener, but since my GameScreen isn't a stage, I can't use that in the inputProcessor. So my question is ...
0
votes
0answers
43 views

TiledMap Safe Area for different screen resolutions

I'm creating a Tower Defense game using libGDX (w/ scene2d) and TiledMap. I've been reading extensively about viewports and how I can better manage various screen sizes. I want my Tiled Map to take ...
0
votes
1answer
50 views

Simplifying Object Factory

I'm making a game for Android using Libgdx with Android Studio in Java. In my game, I have a class called ObjectFactory which has a method createGameObject(int objectType) which receives an integer ...
5
votes
2answers
630 views

Main game objects as static

I'm making a game for Android using Android Studio with Libgdx in Java. In my game there are main object like Screen, ObjectFactory, SoundPlayer, Painter (Responsible for drawing) and a few more. 'til ...
0
votes
1answer
25 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 ...
0
votes
3answers
142 views

How to scale bitmap font without having it pixelated

How do i increase the size of a bitmap font without having it get pixelated, in libgdx?
0
votes
0answers
24 views

AdMob Banner appears 960x150 instead of 320x50 in libGdx - what's wrong here?

I am a bit helpless with this strange effect from AdMob. AdView is instanciated in code and so is the relative layout and libGdx view. View view = initializeForView(Engine.createEngine(G....
0
votes
0answers
10 views

libgdx - objects are drawn elongated when width and height are the same value

I don't use view ports but my camera is set to the screen width and height of the device. My objects are drawn longer(taller?) then they should be. I check my sprites and they are square not ...
1
vote
0answers
40 views

Best way to create defence(withdraw) algorthim libgdx?

I have created user body and enemy body. Enemy body uses the steering behavior created by gdx AI. User body have it own control inputprocessor. World doesnt have gravity. Enemy body arrives the user ...
1
vote
1answer
43 views

Collision Detection Unresponsiveness

I'm creating a simple jumper game in Libgdx that makes the player jump over obstacles in order to stay alive. The only problem is that the collision detection for when the player just touches the ...
0
votes
1answer
50 views

LibGDX Textfield - Text Overflow - Not Wrapping

In my app's registration screen, the textfield is not wrapping text as I expected. Notice in the above image, the email field is not containing the text. I have set the size of the textfield using ...
0
votes
0answers
25 views

libgdx - Math reflection to the correct direction

I'm using a simple reflection system, but the game doesn't work how I want. How should this game work? The game has two boxes. A red side and a black side. The player should only sort the bombs to ...
1
vote
1answer
76 views

Switching Screens without initializing them every time

I have a UI with four Screens (all extending a "main Screen") that users switch between very frequently, at the moment I am switching Screens using g.setScreen(new screen);, but this leads to the ...
0
votes
1answer
67 views

Libgdx Sprite rotation around specific point

I made complex dynamic body that rotates around other body that is static. It works perfectly, however I got messed up with sprite position on that body. Here's what I have now and here's what I ...
0
votes
0answers
59 views

Why is my tiled map moving when I move the camera in libGDX?

I use LibGDX. I have created a map with Tiled Map Editor and loaded it to the game. Everything else is working well, but when I move the camera, the map moves: it jumps or floats. My code: public ...
0
votes
1answer
42 views

Libgdx shaperender within a circle as limitter

I encountered a problem, where my small entities would be rendered out of the bounds of my radar. At the time I solved it like this: ensure, that the object would be within the circle, but, that's ...
1
vote
0answers
110 views

Java Libgdx Attaching Sprite to Box2D Body

So I am working on programming a java 2D platformer for fun on the side and I have a rendered TMX level and a box2d body (just a circle shape) that I am currently using as my player. All the controls ...
1
vote
3answers
99 views

LibGDX - Trying to make a radar-like display

i have an interesting question about geometry. I have two or more moving objects outside of my stage's viewport (blue and red circle in the image below), which i want to point at with two arrows on ...
0
votes
0answers
78 views

LibGDX - black bars, FitViewport and drawing background

actually I'm creating game in LibGDX and i have few problems. I'm trying to solve resolution and aspect ratio problem by using FitViewport but i want to dispose black bars which occur when resolution ...
0
votes
1answer
266 views

libgdx - Math for wall collision when adding velocity

I've created a game which spawns a random colored ball in the top or bottom of the screen and moves to random direction with this method. private Vector2 position; private Vector2 velocity; private ...
0
votes
0answers
47 views

How can I simulate a basketball throw in LibGdx box2d?

So I want to simulate a similar throw like in the game Bouncy Basketball. Do i need to create a body and attach another body on it that would be the arm and then how would I apply force/impulse to the ...
1
vote
0answers
61 views

libGDX text doesn't appear in TextField

A game I'm working on has libgdx's TextField. They work fine in every instance I've used them, however on a play tester's phone he says no typed text appears in the box until enter or space is ...
0
votes
1answer
45 views

I can't center my actors with ExtendViewport, Libgdx

I'm making a level select screen and I need use ExtendViewPort (I can't use Fit for other reasons), but this viewport moves my actors to the left, I need center them. I put X and Y position ...
0
votes
1answer
44 views

What does the TextureRegion.flip() method do?

I'm learning libgdx and don't understand the purpose of parameters passed to flip(boolean x, boolean y). For example, I have code like this: texture = new Texture(Gdx.files.internal("data/texture.png"...
1
vote
1answer
90 views

libgdx - Texture not appearing sometimes

When I run the App the Ball moves sometimes downwards, but sometimes its not moving. I dont change anything on script. What I want is the ball should come from top outside of the screen, but when its ...
0
votes
1answer
75 views

Reskinning assets on-the-fly with LibGDX TextureAtlas

I'm building a game for Android using LibGDX and I'm attempting to add in a skin feature so players can change the look of the game on-the-fly. I've packed the skinnable assets into their own .pack ...
0
votes
0answers
50 views

Scene2D set table cell size in percentage of tables ´s size

Is it somehow possible to set Scene2D table cell´s size in percentage of the table? I would like to have orientation independent menu, with buttons filling let´s say 75% percent of the screen, and ...
0
votes
0answers
49 views

Box2D Physics Crazy

I have a simple Box2D Game with a dynamic player, a static floor, and a matrix of gems. The problem is that the physics engine goes crazy. You can see in this video: https://youtu.be/iaH_ex8eVVk ...
1
vote
1answer
61 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; ...
0
votes
1answer
82 views

What type of networking system should I use With LibGDX on Android?

I've been looking for a good way to implement multiplayer in an Android strategy game I'm working on, using LibGDX. What I found: The embedded LibGDX networking system Kryonet Google Play Services (...
1
vote
1answer
47 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 ...
0
votes
1answer
33 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 ...
0
votes
2answers
95 views

Sprite not drawn on the same position as its Body LibGDX after implementing Pixels Per Meter Division on Box2D

I had a problem where the sprite was not positioned on Body correctly which I solved and you can see it here: Box2D is not positioned on the sprite correctly LibGDX After I solved that, I needed to ...
2
votes
3answers
136 views

Accelerated movement in a specific time to a specific point

I am trying to move my sprite in a specific time to a specific position while using frame-independent or time-dependent movement. My sprite is also accelerated every frame to simulate gravity. I know ...