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.
1
vote
1answer
40 views
LibGDX - how to change FreeType Font color and screen coordinates
How can I change my FreeType Font color? I want to set custom color. I tried do this by using Color color = new Color() but don't work.
And second: can I change my screen coordinates? I use two ...
0
votes
0answers
13 views
Box2D : rotate and set position to a static body with another origin
I try to rotate a static body of a PolygonShape, from another origin, and set the position regarding this new origin.
Why ? Because I create bodies from TiledMapEditor object. And origins of objects ...
1
vote
2answers
35 views
Image Does Not Animate and is Stuck in one Frame
I'm having a problem in my code where the animation from another class does not animate and is stuck in one frame. The image moves across the screen in the right manner though. I know that the problem ...
0
votes
1answer
33 views
LibGDX - huge font
I have big problem with drawing font. My virtual world is 20x15 meters (viewport and camera too). I use FreeTypeFontGenerator. But something is wrong because for example if I have font 40px (40px = 1 ...
0
votes
2answers
28 views
How do you increase the spacing on text within LibGDX labels
So I'm following along with some tutorials for creating an application with LibGDX, and when I go to print parts of the UI to the screen, the text is all bunched up. How do I increase the spacing, or ...
1
vote
1answer
34 views
Undetected Null Pointer Exception in TextureRegions
I have an error regarding Null Pointer Exception and I can't find the exact location of the error in my program. I have searched for probable solutions online but I find none of them helpful. I know ...
0
votes
2answers
30 views
LibGDX - how to close game and dispose objects properly
can someone tell me how to close game and dispose objects properly? I tried several methods but always have problems. I have ImageButton with ClickListener.
Here's code of listener:
exitListener = ...
5
votes
2answers
58 views
LibGDX, How to create a 2d collision terrain
How can I create a surface so my bike collides with the ground?
I'm thinking of placing x,y coordinates, but that will be too straight and I want it more smooth. (I don't want to place 1 million dots)
0
votes
0answers
46 views
How can I render a tmx map at a given location?
I am using libgdx & trying to implement a Binding of Issac like dungeon. To do this I'm loading a tmx map when a dungeon room is created and rendering it to the screen. The issue is that the each ...
0
votes
0answers
19 views
LibGDX placing UV on a generated basic terrain mesh
I'm making my own terrain mesh via code (not really for efficacity but more for understanding meshes and 3d in general) and trying to make it tiled.
Here's my code:
private static Model makeTerrain(...
0
votes
1answer
21 views
Libgdx OrthographicCamera culling problem with zooming
When I set zoom on an orthographic camera to anything above 1 I get a strange black border on the bottom of the screen.
I suspect that this might be some sort of culling problem. I use a viewport to ...
0
votes
1answer
22 views
Libgdx Application terminate in an unusual way
I am developing simple multiplayer game using libgdx and box2D. And Im getting error below.
This application has requested the Runtime to terminate it in an unusual way.
Please contact the ...
0
votes
0answers
11 views
Of Nodes and Motion States LibGDX
I am working with ragdolls in libGDX and bullet. Heres the idea: I have a Model object of a person appropriately exported and loaded. I create a ModelInstance Object from it. The Node's of the ...
0
votes
1answer
24 views
(LIBGDX) args instead of variables names
I added Kryonet to my libgdx project like this...
Created a "libs" folder in core project, droped kryonet.jar in there.
In build.gradle of the root project added this line:
project(":core") {
...
...
0
votes
1answer
16 views
LibGDX: Shape from ShapeRenderer won't show up when put in another class
I am currently trying to make a little snake clone as my second project with LibGDX. I want to draw the borders of the screen with a ShapeRenderer. The Shape gets displayed flawlessly when I create/...
0
votes
2answers
36 views
LibGDX: Max number of textures?
I've been developing a game targeted at android. I know not to think about program optimization until the project is finished, but I have to wonder how many textures most phones can handle safely ...
1
vote
1answer
38 views
LibGDX - change actor's texture
Is there a way to change actor texture without creating a new object?
I want to change my ImageButton texture when resize() is called, and for example for screen > 800px, ImageButton have bigger ...
0
votes
1answer
18 views
libgdx scene2d DelayAction and SequenceAction
I'm trying to get the delay action in scene2d working correctly. I have multiple image objects which I store in an array and I have managed to get them all displaying, scaling and moving correctly. I ...
0
votes
0answers
31 views
a drag&dop for scrollpanel's child in libgdx
I want to make a card-select-screen before MainGameScreen in libGDX,the requirement is:
stage contains a left grid and a right scrollpanel grid
the left grid is meanings seleted card list
the right ...
2
votes
0answers
22 views
LibGDX - how to make sizeToAction relative to other corner than bottom-left?
I'm trying to resize a widget inside a Table.
It's a fullscreen widget and when Android Keyboard comes out, the widget is resized so it fits half of the screen from the top.
SizeByAction works from ...
1
vote
1answer
20 views
Gdx.graphics.getWidth() vs cam.viewport width
I'm facing difficulty understanding the difference between Gdx.graphics.getWidth() vs cam.viewportwidth, What is the difference?
0
votes
1answer
28 views
MultiSwipe in Libgdx
I have some trouble with my GestureListener class i think. I'm just trying to detect swipe on two half screen. I'm creating two InputListener but I can't add them to InputMultiplexer. Actually, I ...
0
votes
1answer
17 views
Strange LibGdx box2d body.ApplyLinearImpulse(); behavior
I have been working on this game NinjaThief and when I apply linear impulse to player body it just keeps on moving. Some of the functions are still unfinished so it looks a bit messy.
Here is my code:...
3
votes
1answer
21 views
Libgdx scene2d not erasing old texture
I've been having trouble with getting scene2d to erase my old texture when I switch screens, and also when I change my label the old label string is still drawn underneath.
public StartScreen(...
0
votes
0answers
26 views
Font and 9-patch enlarged with Viewport
I'm actually using viewport and camera in my game. When I draw the font, the font is enlarged and pixelated, along with the 9patch.And when I disable the viewport(ie, spritebatch and viewport camera ...
1
vote
1answer
42 views
Creating chat bubble using 9-patch and Glyphlayout
I'm trying to create a chat bubble using 9patch as my background and text in the front.It is not drawing anything and I am unable to find the mistake in my code.
PS: I've taken some help from prev ...
0
votes
1answer
41 views
LibGDX: How do I manage Player position?
I'm making a 2D isometric tiled game using LibGDX. In my Player class, I created a vector2 that I named 'pos' to manage the player position, then I draw my Player with:
batch.begin();
batch....
0
votes
0answers
17 views
Static libGDX assetmanager (desktop only)
(I know there are a lot of questions about this on the internet, but most of them warn about android)
Long story short: is this code safe in a desktop only game:
public class Variables {
public ...
0
votes
1answer
22 views
How do you save the rendering of a tiled map to an image?
Im currently using LibGDX and drawing a tiledmap with the OrthogonalTiledMapRenderer. Is there a way to save one rendering and put it into some file as an image? If you know of a method that doesnt ...
0
votes
0answers
22 views
How to set a maximum velocity of gravity? (Box2d)
I'm making a game in Java and I'm using libGDX and Box2d. I have a world with this gravity: (0, -10). So I want to set a maximum and minimum body velocity (10 as maximum and -10 as minimum) in the y ...
1
vote
1answer
50 views
How to detect if game is hidden?
I'd like to pause my game when my app is hidden (user pressed home button or changed app). How can I detect that ?
1
vote
0answers
22 views
LibGDX limit the PerspectiveCamera for a FPS view
I'm using LibGDX and I'm trying to implement a FPS camera into my game. I'm not using the FirstPersonCameraController for multiple reasons:
I don't want to touch to roll (only yaw and pitch), with ...
1
vote
1answer
50 views
Rotate a Crosshair around a sprite - 2d worms style game?? (LibGDX)
I'm currently learning to code 2d games in Libgdx. Right now I'm making a kind of worms clone. I am using Box2d and have just my main sprite and a flat ground object so far.
What im stuck on is ...
0
votes
0answers
24 views
Libgdx font fails to scale well with viewport
I am trying to use libgdx Smartfontgenerator (link below) in my game that already has a FitViewport with my world co-ordinates but it scales out of proportion when I add in my fitviewport. Here's the ...
0
votes
1answer
28 views
Performance optimization when changing Textures LibGDX
In the main Screen class of my game there is a ListArray<Card> which makes up the deck of cards . The Card's texture is set in the constructor like so :
cardTexture = new Texture(Gdx.files....
0
votes
1answer
45 views
libgdx - Trying to load ttf font using asset manager
I tried to load a ttf font using an AssetManager like this:
FreetypeFontLoader.FreeTypeFontLoaderParameter freeTypeFontLoaderParameter = new FreetypeFontLoader.FreeTypeFontLoaderParameter();
...
0
votes
0answers
27 views
How to animate a sprite in libgdx with Spriter
So, I have an animation that I've created in Spriter and a class in libGDX that extends Sprite and contains a box2D body. What I've done previously is have a texture atlas and loop through it to set ...
0
votes
1answer
28 views
how to correctly scale box2d in libgdx
I'm currently using 800x480 resolution and FitViewPort and I divided that by PixelPerMeter variable which is equal to 10 and that helped to move my box2d body faster. But when I tried to use fonts I ...
0
votes
0answers
21 views
libgdx BitmapFont setColor works only the first time
Here's my code:
game.assetManager.get("fonts/zrnic40.fnt", BitmapFont.class).setColor(.5f, .5f, .5f, 1);
game.assetManager.get("fonts/zrnic40.fnt", BitmapFont.class).draw(game.batch, text, x, y);
...
0
votes
1answer
45 views
Repeating a background texture forever in libgdx
My "game" works with a pretty large playing field, so I need a repeating background. I've implemented this the following way:
Loading:
assetManager.get("texture_bg.png", Texture.class).setWrap(...
0
votes
1answer
23 views
LIBGDX Image tearing
I'm making an game in libGDX and I have been noticing some image tearing when camera is moving. Note that it happens only when the game is maximized and the camera x position is less than screen width ...
0
votes
0answers
19 views
Android libgdx - Sound plays only on desktop
I made a simple game in Android Studio 2.2.2 using libgdx. Currently, I use one background loop music and two sounds. When I run the game on Desktop Application everything works just fine. But when I ...
0
votes
1answer
59 views
What is a good approach to dynamically change actor Position?
In my card game there are 2 players with each player having a hand(a ListArray of of Cards.In this case its handPlayer1).
The Card class extends Actor.This is the code I use to deal the cards to the ...
1
vote
1answer
18 views
Is reusing BitmapFonts possible in GDX?
I'm loading multiple labels (100+) with different font types (max 10), but they have different sizes.
As I read the code and did the research, it's not possible to 'reuse' the font.
For instance, I ...
0
votes
1answer
37 views
How to use touchDown?
How to use Screen and touchDown?
...
playButton.addListener(new ClickListener(){
@Override
public void clicked(InputEvent event, float x, float y) {
((Game)Gdx.app....
0
votes
2answers
30 views
How do I get the 3d coordinates of my model Instance? [LibGDX]
I want to get the 3d coordinates (as a Vector3) from my model Instances.
with the following code I can only get the original coordinates, but in the render method, my model is rotating around the Y-...
1
vote
1answer
34 views
Libgdx game crashes on some devices without any Errors / Logs
I'm making a similar game to the talking tom game where a character is animated on the screen and talks back.
I have about 100 transparent PNGs for each animation.
There are 10 Animations.
Each PNG ...
1
vote
1answer
28 views
Libgdx Animation class? not iterating through frames?
I am making a 'simple' top-down space shooter in 2d using Libgdx. I have loaded the texture regions into arrays and created Animations inside my sprite, but when I call the getKeyFrame it seems to ...
0
votes
1answer
39 views
How to handle Game Screens? (libGDX)
In my game the main screen is the playscreen. But because I want to draw the menu and the gameover screen on top of the playscreen, I don't create separate screens for them. But if I want to replay, I ...
0
votes
1answer
28 views
LibGDX Box2d - How to only setLinearVelocity on X axis - problem while jumping
public void update(float dt){
float currentYVelocity = body.getLinearVelocity().y;
switch(currentMoveState){
case moveLEFT: body.setLinearVelocity(-walkSpeed * ppm, currentYVelocity);
...