Questions tagged [libgdx]
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.
2,295 questions
2
votes
1
answer
57
views
Best practice design for libgdx scene2d/box2d in different levels
I've started a libgdx game using scene2d and box2d. It's a 2D top down game, in which you can walk through the world, enter houses, etc. (think of Stardew ...).
I'm wondering, what is the best ...
1
vote
1
answer
111
views
Objects move with different speed on different devices
I was making a 2d top-down game, but when I tested it on two devices (Samsung M31 and Samsung S25) there was a problem with player speed - it was faster on S25 and slower on M31. I tried using some ...
0
votes
0
answers
67
views
LibGDX NullPointerException from a scene 2D Actor calling Pools.obtain()
fire (Event event) method throws the NullPointerException. Trace:
...
0
votes
1
answer
113
views
How to drag existing body to another position?
I have a game object with a Kinematic body and a sprite. The object's "draw" method will always position the sprite to match a position of actual body, so the sprite is completely passive.
...
0
votes
1
answer
86
views
Consistency of accelerometer controls between devices
I'm thinking of making a game where using the phone accelerometer, the player would apply an appropriate force (adding velocity) to a Box2D body. Now, I know technically how to implement that, but I ...
1
vote
1
answer
127
views
Why is my raycast not working?
I'm trying to ray-cast mouse clicks to the surface of a sphere (from which point, I'm going to get the coordinates of the vertex of the sphere's mesh that are closest to the click). The following ...
1
vote
1
answer
146
views
Icosahedron missing triangles
I'm trying to create an icosahedron (I've been trying to figure this out for about a week).
Basically, I followed this article to create an Icosahedron mesh in code, and the positions of the vertices ...
0
votes
1
answer
105
views
LibGdx sprite isn't rotating correctly around its own axis
I'm currently trying to rotate a sprite around its own axis to make it "face" the mouse, but I'm having weird results. This is my code:
...
1
vote
1
answer
200
views
How do I add dependencies to my libGdx project?
I am currently using libgdx and IntelliJ to develop a real-time space 4x game. I ran into an issue, where I am trying to include lua scripts in my project (for the sake of allowing players to mod new ...
1
vote
1
answer
75
views
LibGDX TiledMap - get embedded objects from TextureMapObject
Is there a way of getting embedded objects defined within Tiled's collision editor from TextureMapObjects?
It'd be great if I could place texture objects around on an object layer and also include ...
1
vote
2
answers
145
views
Bullet Physics stopping model from going through static object
Bullet physics tunneling problem:
yellow box(dimensions: 2f, 2f, 2f) that falls under gravity. Its Bullet Physics are set as such:
...
0
votes
1
answer
73
views
Differences between rotations and translations of different camera properties in LiBGDX
I am trying to understand the camera API (applicable to perspective camera ONLY) of LiBGDX.
It really does not make sense that you can call rotate and translate on many different properties of the ...
0
votes
1
answer
93
views
Rotate modelinstance node about its own centerpoint y axis in LiBGDX
I am trying to rotate the node of a modelinstance as follows:
Note: the node and modelinstance are rotating BUT not about their own center Y axis!
...
1
vote
1
answer
225
views
Separate Sword Sprite from Player
I am aware that a common approach in game development for attack animations is to separate the player from the weapon and 'stitch' them together at runtime, depending on the weapon equipped.
This ...
1
vote
0
answers
62
views
Finding a modelinstance in LIBGDX from a Scene by node id
I have loaded a 3d scene from Maya into Libgdx: It has two polygonal objects(meshes)
One object is labeled as: chamber
The other object: it has another name
I load the Maya scene as such:
...
0
votes
1
answer
69
views
Modifying the transform of a modelinstance in libgdx
Using libgdx I need to move back and forth by a very small amount a soldier head:
I do the following: But the soldier head is flying up into the y axis out of the screen:
...
0
votes
1
answer
120
views
Understanding vector2 set in Libgdx
I am trying to understand why in the following code the programmer user vector2.set() ?
...
0
votes
1
answer
99
views
How to save score without resetting to 0 between Game Scene and Pause Scene?
I'm currently working on a LibGDX Java Game Project inspired by the Space Invaders game where I have created 2 Scene Classes: LevelScene and ...
1
vote
1
answer
141
views
LibGDX websockets GWT html app cant find source to WebSocket class
I'm using this library to connect to websocket server:
https://github.com/czyzby/gdx-lml/tree/master/websocket
It's working on android/desktop applications, but when compiling to html gwt app with ...
1
vote
0
answers
50
views
LibGdx switching between multiple UI panels
Let's say I have a game screen with a game world stage and UI stage. UI has a build button in the corner which should open a full screen build menu window/panel while hiding game world and the ...
0
votes
0
answers
60
views
I use skin composer, I want to create scene in scene composer, I can't add text buttons even though I created text buttons
I create text buttons, add every image and font, but it's still disabled when I want to add button in scene composer. I'm probably doing something wrong.
0
votes
1
answer
81
views
libgdx resize works fine, except on setWinowedMode
I'm a bit baffled by a specific bit of behaviour in LibGDX.
The resize method of my screens is as simple as can be, because right now I don't need anything more:
...
0
votes
1
answer
90
views
Modifying LibGDX vector2's seems to do nothing
I have a piece of code similar to this:
Vector2 test = new Vector2().setLength(20).setAngleDeg(45);
But when I'm trying to print its contents (such as ...
0
votes
1
answer
208
views
How to adjust parabolic trajectory to hit the same point with the same launch angle, but faster speed?
I'm launching a ballistic projectile similar to this sample.
The projectile moves from the launch point to the target point, but it's too slow. When I try to increase the speed without changing the ...
0
votes
1
answer
286
views
How to improve performance of LiBGDX Android app?
After creating a few bodies and a map with collisions, the app performance clearly goes down. However, RAM and CPU don't seem fully stuck, but the game experience is horrible nonetheless.
GameScreen ...
1
vote
0
answers
138
views
Animate buttons sliding in
I am developing my first libGDX game.
I want to animate the buttons on the stage, so they transition into view instead of just popping into appearance. For example, each button should slide in from ...
1
vote
1
answer
176
views
How to render picture-in-picture effect with libGDX camera
libGDX cameras are mostly used for layered rendering with different "world unit size," but I wonder is there a way of showing the view of for example a libGDX Orthographic camera in the ...
0
votes
1
answer
702
views
How to add text on screen using bitmapfont in libgdx?
I have a function class that implements Screen with a bitmapFont variable in it
...
0
votes
1
answer
165
views
Pass input event from stage to added actor
I am diving into libgdx and used their sample game as a starting point.
I also added a touchpad to move the bucket. That was kind of easy and worked flawless.
My additional idea was to make the ...
0
votes
0
answers
242
views
Fix stuttering with fixed time step and interpolation
I am trying to fix my stuttering by using a fixed time step, but I seem to be missing something because it is not working.
Can someone look at this and see what is missing?
...
0
votes
1
answer
279
views
Libgdx zoom and pan the map at the same time
I was able to do the zoom logic and pan logic, but like in google maps, I want to be able to zoom to the map and at the same time pan the map near to it.
Example
starting position:
zoom to kennedy ...
1
vote
0
answers
166
views
Libgdx table contents are expanding beyond widget bounds
I have a libgdx table that initially looks like this...
And I'd like the last cell to expand so that the logical bounds fill the widget bounds. As soon as I set the last cell to expandX it looks like ...
0
votes
1
answer
116
views
Tile system Meta data
I am creating a strategy game in LibGDX with a tile system and destructible tiles. I am using an array of enums to represent the different types of tile, eg:
...
1
vote
1
answer
132
views
LibGDX Invalid animation during actor rotation
I have a problem with the animation when setting the actor's rotation. Every now and then the server sends an updated actor's rotation position. The client uses interpolation to smoothly update the ...
0
votes
0
answers
249
views
Timer for enemy up and down java/libgdx
I want to make the selected enemy increase position.y by 1.0 and after 1.5 seconds return to the original position. I already use a timer of 2 seconds because I need to select a random enemy every 2 ...
1
vote
2
answers
348
views
Libgdx World point to screen point
It seems like converting a screen point to a world point is easy in libgdx but going from the world point to a screen point is quite tricky.
So How do I convert a world point into a screen point?
-1
votes
1
answer
160
views
Draw more sprite but they disappear
I have a array of sprite in a class "Enemy", I want to draw enemies in some positions, but when I draw one, the previous one disappears.
...
0
votes
1
answer
277
views
Drawn enemy random on different position
I would like to insert random enemies in the map in different positions. It's possible?
This is how i load image of enemy:
Enemy.java:
...
1
vote
1
answer
133
views
reposition object in circle
As you can see on the image, I have a p1 and p2 objects with (x,y) coordinates which I know the values, and I know radius of all these circle objects.
However, I want to calculate new position x,y ...
1
vote
1
answer
111
views
Fade in with stage libgdx doesn't work
i use a stage on my background but the fadein doens't work. This is my code:
...
1
vote
1
answer
764
views
Create a transition fade out in libgdx
How can i create a fade out in libgdx? I have a class "Menu" and with a fade, i want to change class to "Game".
This is how i change class, from "Menu" to "Game"...
3
votes
1
answer
1k
views
LibGDX - My sprite glitches when it moves
My player sprite glitches when it moves across the screen. I've tried multiplying movements by delta time. I've tried rounding. It seems to do this completely at random. Sometimes I can move it all ...
-1
votes
1
answer
224
views
Can I use Libgdx to create a game that runs on multiple platforms?
I created my first game using Libgdx and Android Studio. The game runs smoothly on my Android phone. How can I run it on an Apple phone with IOS or a computer with Linux etc.?
0
votes
1
answer
169
views
Error using Asset Manager for loading files from Android temp directory (libgdx)
I'm creating a game for Android using libgdx and Google Firebase for storage. In my Loading screen I download a file from Google Firebase Storage and store it in a temp file. After the dowload ends ...
0
votes
0
answers
74
views
How to not resize but move widgets when screen resized?
I have added buttons to my code, but when I go to "resize", they get bigger or wider and it looks very bad. How can I resize the window and keep the button aspect ratio?
This is my code:
1)...
0
votes
1
answer
116
views
Orthographic camera in libgdx does not work with constructor when passing viewports size
I am playing around with LibGdx and its OrthographicCamera and notice something, what is really strange for me. I mean if you look into the code below you will see that I am initialising ...
0
votes
0
answers
210
views
Box2D Body cannot be serialized. How to ignore or serialize it successfully?
In my game, which implements the network functionality with Kryonet, I would like to send a class ("MyBox2DComponent") over the network which e.g. contains a field of type Body (Box2D).
Of ...
0
votes
0
answers
78
views
HashMaps with String keys as animation keys okay?
In my project I use an ECS system. I have a SpriteComponent that contains a map of animations.
...
0
votes
1
answer
172
views
Libgdx OrthogonalTiledMapRenderer doesn't render properly
I will simply leave a clip of it as it's easier than describing the problem.
https://i.sstatic.net/bBAVC.jpg
This is All the code that i have
...
0
votes
1
answer
135
views
Is there an algorithm for a Joystick class that happens to be engine/framework independent?
I need to be able to get the given input's distance inside the joystick, bounded within -100% and 100% and an unbounded version of it, get the position of where the mouse's position projects to the ...