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

1
vote
1answer
64 views

Libgdx: Check collisions in Stage among actors

My goal is to check collisions among the actors that are in the Stage. My question is: is it necessary to maintain a list for each type of actor I have? Doing that I get 3 problems, 2 bad design ...
1
vote
0answers
37 views

Libgdx box2d - what is the best approach to spawn an actor on a stage dynamically?

I'm currently building a 2d sprite infinite runner game, but everytime I spawn new enemy(actor) and platform, I noticed that there's a delay on it. Any idea of what would cause this behavior? I'm ...
1
vote
0answers
16 views

LibGDX: Box2d hovering, rotating body

Hello I am working on a hovering triangle (equilateral triangle). The triangle should allways rotate at a constant speed and hover over the ground. The problem is if I setAngularVelocity it does rise ...
4
votes
1answer
69 views

How to spawn Chunks in Libgdx?

I'm currently working on a 2D platforming game with an infinite map. I did my research and I discovered that I can use chunks. Based on my understanding chunks is about spawning terrain at the right ...
4
votes
0answers
120 views

Ledge climb animation and movement (2d platformer)

Struggling to make a decision on the implementation of a ledge climb mechanic for a physics driven 2d platformer. What is the best way to go about this without it getting overly complex? So far I ...
4
votes
1answer
74 views

Finding it difficult getting to grips with LibGDX [closed]

So I have spent about a week now learning libGDX and have made very little progress. I started small and wanted to make a strategy game where there is a tiled map of squares and you control a ship, ...
3
votes
0answers
43 views

Is it possible to use OpenCL in libgdx?

Been looking for a way to implement some OpenCL stuff in my libgdx project. It's possible via LWJGL which libgdx is based on, but it's only for the Desktop environment. Would like to have it cross ...
1
vote
0answers
41 views

Unable to load Blender animation into libgdx

I am trying to load an blender animation into libGDX for an android app. So I created an animation using Blenders action editor, I exported this into .fbx format. I then ran the fbx-conv tool to ...
2
votes
1answer
32 views

Libgdx : surround sound

in libgdx there is a lot of audio classes but i haven't seem to of found anything relating to balancing sound in one speaker and or the other to get surround sound say you check if an object is more ...
3
votes
1answer
68 views

Shaperenderer circle line width

Is there any way to increase the width of the line that makes up the shaperenderers circle? shape.begin(ShapeRenderer.ShapeType.Line); shape.setProjectionMatrix(batch.getProjectionMatrix()); ...
2
votes
0answers
13 views

Eliminate an Actor dragged outside SlotTarget

As the title suggests, i would like to eliminate an Actor from the Stage when the player moves it outside my SourceTarget. The default behavior of DragAndDrop class doesn't allow to drag an Actor on a ...
1
vote
1answer
33 views

Getting an object to shoot directly towards click libgdx java

I am trying to get my player to shoot a spell and it travels to where ever the player clicked. I can easily accomplish this by doing the following. if(position.x >= destination.x - 1 ...
2
votes
1answer
41 views

Changing the direction of a particle in libgdx java

I have a particle the explodes upwards. This would work the way I want if the particle always hit the ground. However I want the particle to explode at a -90 degree angle if it hits a wall from the ...
1
vote
0answers
83 views

UE4 or Unity or Libgdx for VR project using Oculus rift and Novint falcon

I've to make a multiplayer game Air Hcokey using 2 Oculus rift and 2 novint falcon controllers , I know that these 3 engines support the Oculus Rift but have no Idea if they do support the Novint ...
2
votes
1answer
39 views

Libgdx - Viewport for Tetris-style game [duplicate]

I'm a beginner in libgdx, and I'm trying to create my first game. It's pretty simple, circles are falling from the top and sides of the screen, and the user needs to "blow" them before they touch the ...
1
vote
1answer
65 views

Switch beetween Screen on LibGdx application

i have set main class like this: public class MyClass extends Game { MenuClass menuClass; ActionGame actionGame; @Override public void create() { menuClass = new MenuClass(this); ...
1
vote
1answer
53 views

How to handle complex input

In my Libgdx project i need to handle several types of inputs. In particular these input events are needed in order to interact with the Actors that the user puts in the Stage. The possible ...
1
vote
1answer
81 views

Sprites are rendered as black rectangles in android 4.0.x only

I have some problems rendering sprites correctly on a LG optimus vu (android version 4.0) with libgdx. Basically sprites are black rectangles, while other images that i declare as Texture are correct. ...
2
votes
0answers
57 views

Get a body from TiledMap via MapBodyBuilder and draw a sprite on it in LibGDX?

I use a various of MapBodyBuilder in my Libgdx project. I created a body from map.tmx via my MapBodyBuilder and in my SpriteBuilder buildSprite method i created its sprite: sprite = new ...
3
votes
1answer
78 views

Rotate sprite along the angle between two objects

Im trying to make flames follow my object, I set the direction for my moving object using the points between it and another object (using static destination for testing). No matter what I do I ...
2
votes
0answers
34 views

Scene2d cyrillic font

I'm trying to use cyrillic(Russian) letters in libgdx Scene2d. I drop default.fnt and default_0.png (generated with BMfont) into folder assets of my Android project (other files such as ...
4
votes
2answers
227 views

Smooth 1D terrain generation

So I'm pretty happy with my terrain, and the progress on my game. I just want to figure out why the terrain is so steep sometimes. Right now to generate my random seed I use this: seed = ...
2
votes
2answers
102 views

Rows of coins in libgdx?

I have my coin image in the assetLoader class, then I import it into gameWorld. My question is, how can I draw() rows of coins without having to write out 15 different coins? i.e., coin1, coin2, ...
1
vote
0answers
54 views

How to disable static friction in Box2D?

I'm making a 2D platformer. One of the issues is that when the character hits the ground, there's an initial pause and then the character finally slows down to a halt. I believe the initial pause is ...
6
votes
3answers
227 views

Java and Steam JVM deployment

I am currently considering my options for game development and deploying to Steam Greenlight. I really like Java with libGDX, especially for its cross platform Android potential, and I understand that ...
1
vote
0answers
41 views

Getting screen coordinates of actor

I'm trying to tell if an actor exists at a screen position so I can do something if the actor is clicked on. To do this, I first need to get the screen coordinates of the actor so I can compare it to ...
5
votes
1answer
137 views

How do I implement tilt controls that work even when the device is not vertical?

I'm using libGDX to develop an Android game. The main character can be moved freely in the 2d plane by tilting the phone. The relevant part of my current implementation looks somewhat like this: ...
2
votes
2answers
53 views

How to stop Follow Path steering behavior when reached target?

I'm using libgdx Follow Path Steering Behavior in my top-down game. When unit reaches the end of the path, it goes to the start (not directly, but following path), then to the end and so on. How to ...
2
votes
0answers
63 views

Native vs Framework development for simple board game development [closed]

I have been working on a simple word game like Hangman Pro but for a different language and I have been using libgdx blindly. After a lot of hassle and unnecessary distractions, I am beginning to ...
2
votes
0answers
52 views

Creating a bitmapfont from images?

A bitmapfont consists of a image and a textfile that hold the position and size of each character on that image. Is there any way to create the text file with just a image? Or do I have to manually ...
2
votes
2answers
84 views

Android libGDX FreeTypeFontGenerator exception

I am working on a libGDX project for Android. Since I added the following code, running the game on my Android phone produces an exception: final FreeTypeFontGenerator generator = new ...
1
vote
1answer
152 views

How do I delete all saved preferences in my libgdx project?

I want to delete the preferences that saved my last highscore. How can I do this? Here's how I am saving preferences at the moment: prefs = Gdx.app.getPreferences("ZombieBird"); if ...
0
votes
0answers
53 views

Avoiding circular referencing using a Finite State Machine in a Component Based Architecture

While answering this question, I realised I had made the same mistake in my own code for a game I am writing using an Entity-Component System. The problem arose when I decided to use a Finite State ...
6
votes
1answer
130 views

How do I set an object's speed to arrive in X seconds?

I want to move an object to a point in the game world, I have the distance value which is far the player should move. I want to complete the movement in X seconds. I have tried many equations and ...
2
votes
2answers
87 views

libGDX Error loading font file - Netbeans

I'm trying to load a font in libGDX. But I can't figure out want I do wrong. Code: white = new BitmapFont(Gdx.files.internal("fonts/white.font"), false); Error: Exception in thread "LWJGL ...
3
votes
1answer
263 views

Steering behaviours: collision avoidance with rectangles

I'm trying to implement collision avoidance steering behaviour using rectangles. Most of the tutorials I've found are with circles, and there's a substantial difference. For example, I've been reading ...
1
vote
1answer
74 views

How to detect if two sprites are being touched at the same time?

I tried this: if(spr.getBoundingRectangles.contain(x,y)){ //do this } but how to detect if the other sprite is touched by the second pointer? Then I created two Vector3 for the pointer ...
0
votes
2answers
62 views

How do I properly load maps?

I'm trying to load my map properly, but it takes some time (after the games has been started) to be how it should. Am I doing something wrong? Why is this happening? AndroidStudio: Tiled (map ...
1
vote
1answer
22 views

Convert MathAtan2 angle to degrees

I use an angle to set the velocity (or direction if you prefer) of my sprite, however, I want the sprite to be heading in the same angle as I'm moving, rotating according to that angle. How I set ...
1
vote
1answer
131 views

Dynamic Events in an Entity Component System

My game makes extensive use of libGDX's Entity Component System Ashley, and my game world (including all levels and areas) is created with Tiled. In Tiled, I have an object layer where all of my ...
2
votes
1answer
161 views

How do I check for collision between an ellipse and a rectangle?

I am working on LibGdx framework for developing a 2D isometric tower defense game.All my sprites are drawn in 2D isometric view. I have used an array list to store 8 points at boundary in the ...
1
vote
0answers
30 views

Physics Body editor loader collision detect

In my game I use the Physics Body Editor to add custom shapes to my bodies. In my show() method I use the follownig code to create my Jetski Body: BodyDef jetskiDef = new BodyDef(); ...
0
votes
1answer
59 views

libgdx FollowPath proper usage

I'm developing top-down rpg game and got some problems using https://libgdx.badlogicgames.com/gdx-ai/docs/com/badlogic/gdx/ai/steer/behaviors/FollowPath.html I have a path (picture 1), in this case 2 ...
0
votes
2answers
83 views

Slingshot gravity effect

I am trying to make a sling-shot that fires a projectile. I want it to act like the standard sling-shot in angry birds. So far I managed to get the "pulling" effect, ie. If I draw backwards it fires ...
1
vote
1answer
28 views

set sprite to current animation texture

In my game I have some box2d bodies where I add sprites using the following code in my render() method. for (Body body : worldBodies) { if (body.getUserData() instanceof Sprite) { ...
0
votes
1answer
66 views

Certain Unicode Characters not displaying when setting text to TextButton in libgdx

Ok I am trying to do a word game much like Hangman Pro but for a different language(specifically amharic) using libgdx . And I have got a list of words saved to text file and I have taken care of BOM ...
5
votes
1answer
215 views

AI pathfinding in mostly-free space

I'm working in an action/strategy proyect. Consider it a RTS game. The game is in 2D (with LibGDX), and I have a lot of soldiers moving along. Now I have to implement the AI. Let me say some things ...
0
votes
0answers
86 views

libgdx drawn a projectile trajectory cannot render

I am looking to draw a projectile trajectory . I found a lot of code such as : http://blog.gemserk.com/2012/07/03/drawing-a-projectile-trajectory-like-angry-birds-using-libgdx/ The code I editor; if ...
1
vote
3answers
26 views

undo touchdown in LibGDX with scene2D

i'm making a game in libgdx and i have a question. I have a Button from scene2d. If there is a touchDown event on this button, i want the touchUp event only inside my button. Now if i touchDown a ...
1
vote
1answer
54 views

My Sprite is disappearing when it collides with my floor (libGDX)

I am just starting to build the game "engine" and I am using a sprite drawn in the same position as a rectangle and the two always move together. I have another rectangle which is the floor when the ...