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
1answer
482 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
88 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; ...
1
vote
0answers
12 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 ...
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
68 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
81 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
186 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
66 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
1answer
19 views

Online multiplayer game room management question

I have online board multiplayer game (quite similar to draughts/checkers) with room management system. I have some concerns connected with it. One of them is a question if it is better to delete room ...
0
votes
2answers
13 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
89 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) ...
2
votes
2answers
95 views

2D - Smooth lighting with shadows for a tile-based game

for the last week or so I have been completely stuck on trying to implement efficient lighting. I've been researching and experimenting and I've looked everywhere that I have been capable of finding, ...
1
vote
1answer
32 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
20 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
24 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
20 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 ...
0
votes
1answer
57 views

LibGdx Scalling sprites on Android

I have a sprite that is a few buttons but need them in the center of the screen for all android devices. I tried setting it's location to the center of the screen by dividing the orthogonal camera by ...
0
votes
1answer
17 views

In Scene2D, does Actor.hasActions() no longer exist?

Eclipse does not allow me to do while (actor.hasActions()){} saying it's undefined for type actor, but the libgdx API still has it as one of an Actor object functions.
2
votes
1answer
25 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
422 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 ...
0
votes
1answer
70 views

LibGDX make an object rotate around something

I need to rotate and object, which should be a circle made up with a ShaderRender, around a specified point. In LibGDX there is a method or something which allow me to do this? If it doesn't exist how ...
1
vote
1answer
97 views

Libgdx understanding screen size

I'm trying to create my own jumper type game where the player moves up through an infinite y value. The problem I am having is getting the screen size to match up with the android screen. viewport ...
1
vote
2answers
70 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 to bodies collide collision is detected multiple times. here's the code `public void preSolve(Contact contact, Manifold oldManifold) { Body a = ...
0
votes
1answer
13 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, ...
0
votes
0answers
32 views

Design the game Stage in libgdx

Let's assume my Stage has this structure: A Table with cells (like a matrix) centered in the screen Each cell of this Table has an Actor associated to it I have to add actors also in the remaining ...
1
vote
2answers
71 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
1answer
158 views

How do I make my main character move towards an object? LibGDX/Java

What I want to happen is for my player to bounce from spring to another. For example take the illustration below: Here's my code (what I've tried to do so far). This gets called in an ...
1
vote
2answers
875 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 ...
1
vote
1answer
475 views

LibGDX - Box2D: Realistic Light and Layers

I'm having some problems with my current game. Short description: It's a 2D game where you have to avoid the lights or you lose HP. My problem is the following one: Here is the rendering process: ...
0
votes
2answers
328 views

Basic 2d platform collision detection algorithm has a slight bug (Java)

I'm trying to implement collision detection between Player (the main character) and a Platform. They are both modelled as rectangles; when player hits the side of a platform he should bounce off it ...
0
votes
2answers
107 views

Game lags when my player collides with a specific object (solution known, unsure how to implement)

I'm developing a game in Android using LibGDX (although this is more of a JAVA problem than an engine problem). My aim is to have my player bounce off one spring onto another that will eventually take ...
1
vote
2answers
29 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
22 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
137 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 ...
0
votes
2answers
96 views

LibGDX particle emitter rotation

I have a libGDX game, in which I'd like to make some ice breath like effect using particles. So far we made a cone like effect. I can obtain and render it on the screen with this. ...
0
votes
2answers
453 views

LibGDX , Scale button with animation when it is pressed

I am developing game using LibGDX . I want to create beautiful menu and to scale buttons when they are pressed but not in this way , when it is pressed scale it 1.5f , I want to scale it with ...
1
vote
1answer
26 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 ...
0
votes
2answers
337 views

Card game - creating card Listener

I am making a card game where there are 21 cards on hand and 2 options from where user can draw cards to his hand and throw a card from hand. I am new on game development and I'm following the ...
1
vote
1answer
27 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 ...
0
votes
1answer
925 views

Libgdx actor bounds are wrong

The Actor's boundaries are not centered at the ButtonText but I used the setBounds() method. The higher the Y position is, the less centered is the boundary. The weird thing is that i only created ...
2
votes
1answer
347 views

Word game - board implementation?

I'm working on a boggle type game for android, using libgdx. The user is presented with a 4x4 grid of letters and must find words by dragging their finger over the letters. Unlike boggle I want used ...
2
votes
2answers
60 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
1answer
409 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 ...
1
vote
2answers
55 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) { ...
0
votes
1answer
43 views

2D Collision Response

I am trying to implement collision response in my libgdx game. I'm using Rectangle objects as my bounbing boxes. This makes collision detection very easy, however I can't quite get the response ...
1
vote
1answer
14 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
22 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
37 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 ...
0
votes
1answer
55 views

How can I update a Stage-based HUD from another Stage's Actor in libGDX?

I feel like this is a simple problem, but I'm having issues finding the correct search terms. I have a Screen that includes two Stages. The first, stage, contains a number of objects deriving from ...
1
vote
1answer
29 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 ...