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
67 views

my movement is working good on keyboard but on android its not

So basically here is what my movement is like for keys: key down if (keycode == Keys.LEFT) { mishi.getAcceleration().x = -13; } key up if (keycode == Keys.LEFT) { ...
6
votes
3answers
2k views

How do I render a PNG with transparency in LibGDX?

I'm building a simple tic-tac-toe example with LibGDX. I have simple images: cross, circle and board, all pngs created with GIMP with a transparent background. How can I render them as a Texture with ...
0
votes
0answers
58 views

Using libgdx to display different textures above and below generated terrain

I'm working on a Scorched Earth clone using libgdx. So far I've been able to dynamically generate the terrain as seen in the screenshot below: The polygons below the terrain surface are currently ...
0
votes
1answer
114 views

Two issues with testing LibGDX on Android

1) When I test my game on desktop it is 100% fine. When I test it on my Nexus 7 physical device, it is the same except the backgrounds have no color. For example my splash screen has a greenish ...
0
votes
0answers
88 views

Collision in Tiled Map - LibGDX

I have collision code that deals with left or right or top or bottom. I am using Tiled Map with LibGDX. Question is: How do I detect collision with other cells by all 4 sides, and not specifically ...
1
vote
1answer
259 views

What is the delta value passed to the Screen's render method?

The delta value given to the render method in the Screen class is a non-constant number. What is it? Where does it come from? Does it differ by screen size?
0
votes
1answer
146 views

How to add a nice looking muzzle flash to the tip of my guns [closed]

I am making a top down shooter and would like to add a muzzle flash to the tips of my guns. So I have an idea of what I want to do which would be just a circle that would fade from yellow to white or ...
0
votes
1answer
971 views

How to update libgdx scene2d Label text dynamically?

I display a BitmapFont on the screen, update its text and the font is updated dynamically on the screen as well. I seem to fail to do the same with a scene2d Label added as actor to a Stage. The ...
0
votes
0answers
72 views

SelectBox in LibGDX doesn't display and freezes the program after a click

I am currently trying to apply an overlay with LibGDX over my 3D ModelBatch. Everything works fine except for the SelectBox. Once instanciated, it shows up on my screen I can click on it once but then ...
0
votes
0answers
80 views

How to make good looking bullets with a trail for top-down shooter?

So I am making a TD shooter and was wondering how to make fancy bullets. Right now I have a giant sprite of a bullet trail that is the bullet as well but it doesn't look that good. I am using libgdx ...
0
votes
1answer
62 views

Is there any reasons to make sprites and bodies line up?

So in LibGDX the Sprite objects position is where it's 0,0 mark is in the word. In Box2D a a bodies position is in it's center. So to line these up when you update the sprites position with the ...
0
votes
0answers
32 views

GWT problem with Box2D WheelJoint

I am using the below libgdx java code for a wheel joint and rear axle using Box2D. This works fine for android, Desktop, but when I attempt to run through GWT I get the following error. at ...
3
votes
1answer
164 views

LibGDX How to take screenshot and use as background for pause screen

So I am trying to take a screenshot of the current situation during the PlayState of the game and when the player pauses the game I want the game to take a "screenshot" save it in memory and not as a ...
3
votes
2answers
132 views

Blending semi-transparent images while not stacking their alphas

In libgdx/OpenGL ES I want to render multiple semitransparent textures while keeping the alpha still semi transparent. For example If I render a 0.5 alpha circle on top of another 0.5 alpha circle, ...
0
votes
2answers
136 views

Best practice for handling “dead” objects and their particles

I'm developing a side-scrolling run'n'gun game (but with planes! :P). I'm an experienced coder, but new to game development. When an enemy plane collides with a friendly missile, I start an explosion ...
0
votes
0answers
53 views

Swing and LwjglAWTCanvas

I use LwjglAWTCanvas in my jFrame. I want to load textures on some swing event(I did it from postRunnable in order to get OpenGL contex). final LwjglAWTCanvas hexagonEditorCanvas = new ...
1
vote
0answers
268 views

Resize the Texture Region (parallax background) to fit my screen size in libgdx

I am using libgdx to make a running game. I am using vertical parallax background. I have successfully implemented parallax background many times. But for this game, I want my Texture region to fit my ...
2
votes
2answers
422 views

How do I render a rounded rectangle in libgdx?

I've been thinking of ways to render a rounded rectangle in libgdx. I haven't found a pre-built way in the documentation. I've looked at: ShapeRenderer, but that's apparently quite expensive ...
2
votes
2answers
2k views

rotating menu with Actors in libgdx

I am intending to build a circular menu, with menu items equally distributed around the circle. When clicking on a menu item the circle should rotate so that the selected item is facing the top. I am ...
2
votes
1answer
51 views

How do I dynamically set a WheelJoint's anchor points?

I've created a car in RUBE and imported it into my game. The game has a tuning menu, allowing the ride height of the car to be adjusted with a slider. I can't work out how to change the position of ...
0
votes
0answers
43 views

How to deal with different origins (y-coordinates) in libGDX?

I have a background image drawn to the screen with 0,0 coordinates in the bottom-left corner, as usual. Then I also have a (transparent) Pixmap in the same size as the background image, drawn on top ...
0
votes
1answer
236 views

libgdx: Rotate sprite on 3d plane

Im trying to create a game on a 3d plane but with 2d objects. I have a perspective camera and the ground plane drawn. I can't seem to get sprites onto it. I am trying to render the sprites, then to ...
1
vote
0answers
201 views

How can I transform a group of objects in libGDX?

I'm new in LibGDX. I created group with actors in show method and add listener (where i calculate rotation matrix) and want to rotate all actors from group with ...
0
votes
3answers
153 views

Exception in thread “LWJGL Application”

I'm using libGDX for my android game in which I'm trying to use bitmap fonts. I have created .fnt and .png bitmap files using Bitmap font generator of angel code.Both .fnt and .png have been placed ...
0
votes
1answer
111 views

Libgdx. Converting Screen Click Coordinates into World Coordinates for 2D Game

I'm using the InputHandler's touchdown method. It gives me my screenX and screenY. Is there a simple way to convert screenX and screenY to world coordinates? By my understanding, InputHandler returns ...
2
votes
0answers
224 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!
1
vote
1answer
163 views

Aspect ratio in LibGdx

I'm learning LibGdx and I need some help with the camera. Let's see, I'm making a Chu Chu Rocket! clon to start. I've loaded a TiledMap (10x10), and I've created an OrthographicCamera to show the ...
4
votes
1answer
482 views

Why doesn't my android application rotate when I rotate my screen

I am building a game in LibGDX and the game screen orientation is in landscape. I want it to stay in landscape but I still want the user to be able to flip the device onto the other side and the ...
0
votes
1answer
58 views

LibGDX: Miscalculated polygon collision

These 2 polygons are not colliding, though this method returns true: Intersector.overlapConvexPolygons( new float[]{ 100.0f, 750.0f, ...
1
vote
1answer
461 views

Handling XBox 360 Controller Connections in LibGDX after Game has Started

I am currently making a game with the java library LibGDX and want to add XBox 360 controller support using the GDX-Controllers extension. At the moment I have a setup where I create a listener to ...
0
votes
1answer
181 views

What is the approach of creating an image puzzle game with libgdx

I would like to create a game which consists of taking a random image, slicing it up into some number of pieces (according to a selected difficulty) and letting the player solve the puzzle. I've ...
0
votes
0answers
56 views

Slowdown in sliding background with Libgdx

I´m new with libgx and i have a basic question. I want an background like an image that repeats indefinetely, and moves down. I did with 2 images and it worked, but the problem is that is very slow. I ...
1
vote
1answer
85 views

How to poll input for a gui in libgdx?

Ok, so my question is simple. How do you poll input with a GUI class without it affecting what's underneath the GUI? So suppose you have an RPG game with a gui for the d-pad and other controls: ...
0
votes
1answer
458 views

Navigating Libgdx Menu with arrow keys or controller

I'm attempting to make my menu navigable with the arrow keys or via the d-pad on a controller. So Far I've had no luck. The question is: Can someone walk me through how to make my current menu or ...
1
vote
1answer
277 views

Movement and rotation of bodies in top down game

We are developing a 2D top down game with libgdx using the included box2d as physics engine. We don't want our bodies to accelerate but to instantly move with the wanted velocity. The bodies are ...
0
votes
1answer
149 views

How to clear out a drawn texture from the screen in libGDX

I am trying to clear out the drawn texture from the screen. Lets take a classic game example - in many games when the character goes through the coins the coins clears out from the screen and ...
0
votes
1answer
387 views

LibGDX cannot save to internal file

I want to save the state of the game in a file, so I can read it at the next start. The Problem is, that I get a exception, if I try to save something internal. If I try to save it local all work ...
2
votes
2answers
443 views

How to draw a rectangle or curve between two co-ordinates in libGDX

I am new to libGDX.I just want a Rectangle or a small curve drawn between the object and the clicked position .I know libGDX has RECTANGLE class. I just want to draw a rectangle or a curved line to ...
0
votes
1answer
101 views

libGDX without android dependancies

I want to create a game that due to some assumptions doesn't make sense as a tablet game. I already created some frame (controllers, autowiring, build scripts, etc.) that would help me later on, but ...
0
votes
1answer
305 views

How to get width and height from a body in box2d?

I am working on a game in Libgdx framework. I have to get width and height from a body in box2d. is their any way to get width an d height from a body in box2d??
0
votes
0answers
103 views

Box2dLights rendering in bigger scale

So basically my box2dLights are rendering in wreid places. The circle in center is my player and as you can see lamp which should be aligned to player is in the right-top corner. my code: package ...
1
vote
0answers
218 views

shader program vs spritebatch [on hold]

I try to draw mesh with my own shaderProgram private static String vertexShader = "attribute vec4 a_position; \n" + "attribute vec4 a_color;\n" + "attribute vec2 ...
0
votes
0answers
18 views

Artificial physics : ball angle bouncing (Vector2) [duplicate]

My question is : how can I manage to move my object (ball) on a trajectory , and onContact with another object, it bounces, respecting the angle
1
vote
1answer
333 views

How to match user click and the sprite object position in libGDX framework

I am using libGDX Java framework for developing a practice game in Eclipse. My game is in landscape mode and I am using sprite image for game assets. Actually I am trying to follow the Kilobolt ...
0
votes
0answers
52 views

White background on BitMapFont

I've tried placing a white "background" on a font that is being rendered with LibGDX, with no success. I'm using the font.draw to draw the loaded font on the screen, but every way that I tried, the ...
1
vote
1answer
74 views

how to make different sprite when moving and aiming [duplicate]

I want to create top down game where you are Russian soldier in libGDX. The player controls the soldier with W/A/S/D and aims with the mouse. That way the soldier can run sideways and shoot towards ...
1
vote
1answer
126 views

Best mobile games resolution ratio

What is the best landscape and portrait resolution ratios that will fit the most of the devices out there and the black bars size will be minimum?
0
votes
0answers
67 views

libgdx get rotated sprite coords points

I would like to get the position of each edge of a sprite when he has been rotated. I have no idea how to do it, I made a image to explain it. I would like to get the X and Y position of each Red ...
1
vote
2answers
103 views

How can I fix my sprite being rotated 90 degrees more than toward the mouse?

I am trying to get a Sprite in LibGDX to look at the player's mouse. Here's the code I have (mind you, I am using JRuby): target = mouse_position.sub(spatial.position) rotation = ...
0
votes
1answer
93 views

How to blend bullet sprite from white to yellow in libgdx

Does anyone have a clue that will make my bullet sprite fade from yellow to white? As the bullet is created it will be white but when it trails on it will turn yellow. Any ideas how? Is it a simple ...