A game library which enables cross-platform game development in Java, with support for Android development and desktop development. It makes use of OpenGL for portability.

learn more… | top users | synonyms

0
votes
2answers
84 views

How do I draw an object that I always want to appear in the same place on screen on a scrolling orthographic camera using lib gdx?

So I want to make an endless scroller game and the orthographinc camera is scrolling downward so i want the character to stay with the camera. I'm not sure how to aproach this i've been looking a lot ...
0
votes
1answer
592 views

How can I implement online high score in LibGDX?

I found some posts that said to use Google Play Services. What about other platforms? Is their some libgdx library that I can use to implement it in core section or do I need to write separate score ...
2
votes
1answer
53 views

[Libgdx]Screen not rendering after restarting game

I have a strange problem while using the libgdx library Game works fine on the initial launch on Android, but after that restarting game does not render the graphics on the screen properly. It is a ...
0
votes
1answer
52 views

Stop rendering hidden objects libgdx

I currently am hiding objects that are not in the frustums view. However, some objects are still being rendered that are in the frustums view, but are hidden. My goal is to not render objects that ...
0
votes
1answer
77 views

Clearing a libGDX pixmap

Is there a way to clear a libGDX Pixmap? Or is the only way to dispose it and create a brand new Pixmap?
2
votes
1answer
23 views

LibGdx OpenGl prevent black part of Light mask texture from overlapping

I am using this masking texture for a dynamic lighting effect in my game: It looks beautiful until two lights begin to overlap: This is obviously because the textures are overlapping when I draw ...
1
vote
1answer
30 views

Scale smaller resolution to full resolution libGDX

Short question about the scaling in libGDX. At the moment i have a application with the resolution 480x320. I define this in the main method of the desktop launcher. My whole application is now ...
0
votes
1answer
333 views

Move Box2D body towards mouse click

In a top down game using Box2D, I would like the player's Box2D body to rotate towards the mouse click, and then move to a point on mouse click (move, not teleport). I have worked out the rotation ...
3
votes
1answer
481 views

How to create heat haze effect in Libgdx?

I would like to create a heat haze effect for a 2D game I am making. Do You have ideas or suggestions, how to get that effect. I am using Libgdx(OpenGL 2.0). Thank You in advance!
0
votes
1answer
119 views

LibGdx - How can I correctly handle tile transitions / connected textures?

So I am making a tiled game and I need to connect textures correctly based on whats next to it. With tiles that had connection really close to the edge of the tile I could just use the 4 bit meathod ...
1
vote
1answer
23 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
2answers
332 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 ...
0
votes
1answer
217 views

libgdx universal tween engine how to control the tweening speed?

How can i control the speed of a tweening sprite? Here is the code: in create () /*try tween*/ w = Gdx.graphics.getWidth(); h = Gdx.graphics.getHeight(); ...
2
votes
1answer
49 views

Keeping Android device awake [closed]

I currently program a game in which the user don't need to interact with the screen. Is there any way to keep the screen awake?
1
vote
1answer
30 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
113 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); ...
0
votes
1answer
181 views

libgdx - Box2d debug draw not correct

I have a problem where the bodies in my debug draw does not draw correctly, take a look: As you can see, there is some space between the dynamic body and the ground. I have checked the contact ...
2
votes
1answer
209 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
0answers
53 views

LibGDX sound playing problem

I'm making a game and I want to play sounds in it. I have AssetManager which loads the sounds and I made a class which has playSound(String sound) method. This method calls the get() method of the ...
1
vote
2answers
42 views

Fading in and fading out animations

This is how I'm creating my player. Is there any way to start fading in and fading out for an amount of time when I get hit? private Texture tex = Game.res.getTexture("player"); public Player(Body ...
2
votes
1answer
151 views

Creating a Melee Weapon in Box2D (libGDX)

I am struggling with how to implement a melee weapon that can swing when a key is pressed. I am imagining two different attacks (stab and swing) I have tried creating two fixtures (character + ...
0
votes
1answer
526 views

Libgdx, how do i get the translation and rotation of a node from a model instance?

I have a model instance of a character, and a model instance of a sword weapon. THe character has a node on his right hand so he can "carry" the sword. Right now I use this code so the sword's ...
1
vote
2answers
183 views

LibGDX Game vs ApplicationAdapter

When I create a new LibGDX project the main class of Core project extends ApplicationAdapter. Here is how it looks like. package com.marimba.apptest; import com.badlogic.gdx.ApplicationAdapter; ...
3
votes
1answer
1k views

How to draw table border in libgdx?

I'm new to libgdx and I'm currently working on TableLayout and wondering how could I draw borders for each cells. I've done some research on this but it seems that I could come up with this solution ...
2
votes
2answers
81 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 ...
0
votes
1answer
85 views

Libgdx with Scala: Overwrite listener

I try to learn Scala the fun way, with a little libgdx project. Now I'm somewhat stuck: val go = new TextButton("Go", style) go.addListener(new ClickListener() { override def isPressed() : ...
0
votes
1answer
191 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 ...
0
votes
3answers
73 views

Which is the best method implementing a background scrolling for game in libgdx?

My question is very simple I am new to libgdx development, which is the best approach implementing a background that is to make the background move in y direction 1)My First approach is drawing the ...
0
votes
2answers
20 views

LibGdx TextButtonStyle Offset not working correctly

I'm intending to give an animation to the TextButton by giving the pressedOffsetX and pressedOffsetY values: TextButtonStyle buttonStyle = new TextButtonStyle(); buttonStyle.font = font25; ...
1
vote
1answer
38 views

LibGDX, BitmapFont strange position behavior

I'm using a Stage of LibGDX to draw a text, in my case the FPS. But after resizing, the position of the text does not behave properly. As you can see in the attached gif: The resizing function ...
0
votes
1answer
34 views

ClickListener getTapCount() returns 0

I want to detect the double tap on a Container. If it is detected, then i have to remove the Actor associated with it. This is my first attempt: addListener(new ClickListener() { ...
1
vote
1answer
30 views

Multiple input not working properly

I have 3 different buttons, one for each action. I want to be able to jump and walk at the same time, but there's a little problem. jumpButton doesn't work while I'm pressing leftButton or rightButton ...
1
vote
1answer
41 views

libgdx - Check if body is touch

I have some bodies around the screen(Ball[] balls), and I would like to delete them when user touches them. Also, I have an Image as userData of the bodies. I dont want to make a function to all ...
2
votes
1answer
45 views

Sounds overlapping when playing too many at the same time

I am pretty novice when it comes to game sound management, so excuse my ignorance. I am having an issue when playing too many sounds at the same time where some sounds stop playing, or doesn't play ...
0
votes
1answer
16 views

LibGDX buttons bounds are wrong

I am making a simple gui in libgdx and run into this problem ; when you click on the button it's bounds (?) are wrong since if I click under it, the game registers it as a click. On the other end, ...
1
vote
2answers
77 views

How to make sprite move in any direction?

I have an arrow sprite that rotates based on where my cursor is pointed, I can only make it move up,down,left and right.How about in a diagonal way? //this is the rotation nt x=Gdx.input.getX(); ...
1
vote
2answers
51 views

How can I add extensions to libGDX

I had a problem with my Font in a game I am developing in libGdx. After some googling I was instructed to use the following code: private void createFonts() { FileHandle fontFile = ...
2
votes
0answers
30 views

balloon ligher than air with libgdx, impementation of FixtureDef.density, gravityScale, linearDamping?

I use libGdx/box2d's physic. My intention is to create a balloon filled with helium (a body, what hovers above a surface, if we apply a little force to it - it moves fast but not far, if we push ...
1
vote
2answers
146 views

Libgdx: different speed on different devices

I am running a simple Libgdx app that I have wrote, on my Android phone and Android tablet and I am getting the unexpected result of having different velocities when a body is moved. To move the body ...
1
vote
1answer
37 views

How do I query a LibGDX Box2DLights “light” and “dark” regions?

I have lighting implemented using Box2dLight. I want to update/render things inside the player's PointLight area. Stuff in the dark area should not be rendered. How can I find which areas are lit or ...
1
vote
1answer
33 views

Scene2D: How to use Image.setDrawable()

I'm trying to change the texture of an Image actor on my Scene2D stage, however I can't seem to get it working. It seems like setDrawable() doesn't really do anything. For example, this will make ...
2
votes
2answers
74 views

LibGdx TextField - Hide Keyboard when not focused - How to?

I'm creating a registration screen for my game. I implemented textfields and input is getting correctly. But when I click elsewhere after text is entered, the keyboard stays visible and does not hide ...
1
vote
2answers
72 views

Libgdx inputlistener scrolled is not working

I am currently using libgdx. Below codes are added to a stage. this.addListener(new InputListener() { public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { ...
1
vote
1answer
19 views

libGDX sprite image not updating Event Handling InputHandler

I created a separate inputHandler class implementing InputProcessor. I'm using Event Handling (libgdx github page: https://github.com/libgdx/libgdx/wiki/Event-handling) public class inputHandler ...
1
vote
1answer
32 views

How to scale LibGdx TextButton?

Apparently textButton.setScale() is not working. Even when the scale is set to 0.1, the button is displayed in it's original size. How to properly scale a TextButton in LibGdx? The official ...
1
vote
1answer
41 views

Playing with hashmap in drawing

I'm developing a game in Java for Android, using LibGDX. In my render(), between the batch.begin() and batch.end() I'm running through all the game objects and draw them. Every game object is stored ...
1
vote
1answer
44 views

libgdx continuous movement while touch and hold (even after jump)?

So, I have these buttons where I have implemented a method to handle 'touch and hold' (without polling). If the player touches and holds the walk button ..it will keep walking till the button is ...
5
votes
2answers
5k views

Problem to match font size to the screen resolution in libgdx

I'm having problems to show text on my game at same size on different screens, and I did a simple test. This test consists to show a text fitting at the screen, I want the text has the same size ...
1
vote
2answers
74 views

How can check a collision between 2 non-axis aligned boxes?

I'm making a simple and easy game and I need to detect the collision between 2 boxes. It only needs to return trueor false, no physics involved. I started working and couldn't find an algorithm that ...
0
votes
0answers
19 views

Design a grid with draggable Actors

A quick overview about what i want to do. I want to make a grid 5x5 centered in the screen in which each cell can contain an Actor that can be moved in another cell. An Actor can be of any type, ...