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

2
votes
1answer
31 views

Scalling down libgdx game to fit a smaller screen appears only the half of the stage?

Hello I have made a game in 1280x720, but I want it to fit devices with smaller size, so far no luck with the current code it only shows the left half of the screen, it also does not work with bigger ...
4
votes
1answer
2k views

Libgdx - IsometricTiledMapRenderer and light shading

I am wondering if there is any way to simulate light shading in Libgdx using an IsometricTiledMapRenderer. Here is my code to draw an isometric map, it's able to be moved around with the mouse and ...
6
votes
1answer
116 views

Minimum number of moves algorithm in Java

I'm looking to implement the minimum number of moves algorithm for the java game I'm developing but I can't quite figure it out. Here's an example picture: There are also some specifications ...
0
votes
1answer
20 views

libgdx: SpriteBatch and ShapeRenderer projection wrong

I'm using LibGDX and the SpriteBatch and ShapeRenderer are having a perspective problem or something... When I draw something with both (code below), the planet texture is smaller than it should be. I ...
1
vote
1answer
61 views

LibBDX create a tail when the object is moved

I am looking for a way to implement in my game a kind of shadow/tail which will be displayed after the object is moved. Should I use animation? If yes how? Here an example:
1
vote
1answer
35 views

Background with small, randomly moved elements in LibGDX

I'm looking to implement a 'dynamic' background (meaning, with objects moving randomly) in my libgdx game, something similar to what you can see in this video (from the Google Play game 'Finger ...
1
vote
1answer
115 views

How to resize animation in libgdx?

I want to draw an animation, the size of each frame is 500x500px but when I try to resize, the animation seems to rotate... Here the code to load frames and create animation: Texture fireSheet = ...
3
votes
1answer
46 views

LibGDX Overlay Game with Stage

I have been working on a 2d game that is similar to billiards/pool. I've got the basic game down and now I'm working on some visual effects. One of the things I would like to do is have have numbers ...
1
vote
1answer
20 views

Libgdx + Ashley moving one texture causes everything to jump

My problem is that as i am moving my player entity all my entities shift position by the reverse total of my player entities movement vector, However the only system to move things is my ...
1
vote
1answer
89 views

Collision with player following mouse

I'm making a RPG with libGDX. I've loaded a TiledMap and now I'm implementing the player movement. The view is top-down. In my game I want two ways of input: one is using the ARROW keys to move the ...
0
votes
3answers
63 views

How To generate spiky terrain in 2D?

I am learning game design, and wanted to know how one can automatically generate spiky terrain (something like this: Cavernaut, notice, the terrain at the sides?). I have heard about midpoint ...
-3
votes
1answer
9 views

how to accelerate and stop a sprite(car) using isTouched() in libgdx

I am working on Android libgdx project. I want to accelerate and stop a sprite using isTouched(). Plz help me and give me a answer with example
0
votes
0answers
7 views

How to set cursor position to middle of screen while still being able to change the Delta-X

I have this code: @Override public boolean mouseMoved(int screenX, int screenY) { float deltaX = Gdx.input.getDeltaX(); camera.rotate(Vector3.Y, deltaX * -0.3f); ...
2
votes
2answers
84 views

create ipa without RoboVM in a project libgdx

I am creating an application with libgdx , and I wish I could produce an IPA without using RoboVM , because since version 1.9 became a fee . I saw on the original documentation that you can do with ...
0
votes
1answer
20 views

LibGDX - How to export a texture as a .png onto, say, the desktop

I'm making a game in which I need to export a texture which the user has edited as a .png into a specified location. I'd like it if I could have the default saving window thing (like on other apps ...
0
votes
1answer
13 views

Method keyTyped in ClickListener is not working

When im click my SelectBox and press some key, nothing happens. sbNationality.addListener(new ClickListener() { @Override public boolean keyTyped(InputEvent event, char character) { ...
2
votes
2answers
421 views

LibGDX - Rendering things in different classes

thanks for your time! I'm really new to LibGDX (and Java itself). Which approach should I use to render my different game parts? I want to show a background, the main character, a bunch of enemies ...
0
votes
0answers
18 views

collision detection with rotating Sprite

Im using Libgdx. I have a space ship sprite rotating around the earth trying to avoid incoming asteroids. The ship is being rotated by setting it's origin in the earths center. How do i detect ...
0
votes
2answers
3k views

SpriteBatch being drawn outside of Stage?

Currently working on my first game, though running into some problems with libgx and screen aspect ratio. What I have is a Stage which contains things like menu buttons etc, and the rest of the game ...
0
votes
0answers
24 views

Get entity at supplied world position LIBGDX

So I'm making a simple 2D rpg. What I need is to be able to interact with the entity that the player is looking at. I need to be able to look at E.g another player in the world and press 'E' and have ...
0
votes
1answer
29 views

libgdx-using more than one class [closed]

Hi i am very new to programming and in this community,so im recently studying on how to develop games with libgdx and all the tutorials only have one class and do all the things in that class,but is ...
2
votes
1answer
223 views

How do I reverse “Cartesian->Isometric” function?

I'm working on an isometric tile rendering engine and I need to reverse a function I used to translate the Cartesian coordinates into isometric coordinates. I've already written a function for this, ...
4
votes
1answer
71 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 ...
0
votes
2answers
69 views

Collision works except for when coming from right side

I am trying to make a bomberman clone. I'm having problems with the collision on the walls that is not on the sides of the map (see image). When I come from the right (going left), the red square ...
0
votes
2answers
34 views

How to implement own UI widget in libGDX?

I want to implement my own widget, here is an image: what I want to get. Instead of numbers there will be some names, but I think it doesn't matter. I'm pretty new in libGDX, so could you please ...
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 ...
0
votes
0answers
29 views

Enable multi touch for Scene2d UI widgets?

I'm using scene2d for my on-screen controls. I have 3 buttons and each one has it's own listener which sets the entities current action on touchUp and touchDown events. However when I hold one button ...
0
votes
0answers
45 views

How to render Fonts with correct size?

I'm making a game using libgdx and box2d so my Orthographic Camera Viewport is only 20x12 pixels/meters, when I try to render the a font on screen it becomes really big and pixelated, I also tried to ...
1
vote
2answers
51 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.
0
votes
0answers
33 views

LWJGL Using wrong openGL version

I am trying to make a game in java using the LibGDX library witch is an extension of LWJGL. LWJGL is claiming that I need at least OpenGL 2.0 with the FBO extension but I only have version 1.1.0. So I ...
5
votes
1answer
117 views

How to detect collision only in non-transparent texture?

I am developing a game using libgdx. I am trying to detect the collision between bee and tube. I am using the following code to detect the collision. if(player.getBounds().overlaps(boundsBot)){ } ...
0
votes
0answers
25 views

Scene2D viewport affects all other cameras despite having a separate one

I have two cameras initialized as such: val mainCamera: OrthographicCamera by lazy { OrthographicCamera(WIDTH * ZOOM, HEIGHT * ZOOM) } val guiCamera: OrthographicCamera by lazy { ...
1
vote
3answers
74 views

How do I make a box don't slide up/walk normally on a slope?

I'm trying to implement slopes in my game. When I walk up the slope and suddenly stop, here is what happens: And when I move down, it goes like this: I have set density to 0.5, friction to 0 on ...
1
vote
2answers
145 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 ...
1
vote
1answer
735 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 ...
3
votes
1answer
112 views

How to deal with overlapping black parts of Light mask textures?

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 ...
0
votes
0answers
32 views

Setting delay when switching from one screen to another in LibGdx

How can I add a delay when switching from one screen to another. Example:Screen1 class extends Game class and screen2 implements Screen implementation. Screen1 uses setScreen() method to switch to ...
0
votes
0answers
17 views

LibGDX: how to implement 2 cameras in a unique stage

I am quite new to LibGDX. I am trying to make a game, where the character is an Actor, and it's controlled by a Touchpad(included in the main Stage as an Actor too). My problem is that I am trying to ...
0
votes
0answers
11 views

Disable buffer swapping in LibGDX

Is there a way to disable buffer swapping in LibGDX every time the "render" call of ApplicationListener returns? I mean - I'm looking on some way to be able to tell the framework if I want the buffers ...
0
votes
1answer
30 views

Storing player data for multiple players in libGDX

I'm working on a game (in libGDX) that would allow multiple player accounts. I need to store some simple user data (several key-value pairs). I think JSON is the best for my needs, but I'm wondering ...
0
votes
1answer
80 views

Why is the alpha value of a Sprite in LibGdx 0.99607843 and not 1?

I'm developing a game in LibGDX and one of my problems is related to the alpha value of a Sprite object. If I create a new Sprite sprite object then sprite.getColor().a is equal to 0.99607843 and not ...
0
votes
0answers
33 views

LibGDX Box2DLights - Global Illumination

I'm using LibGDX + Box2D to create dynamic lights in my game, but I'm currently stuck. I'm trying to light up every game object in the game with its own shadow, kinda like global illumination. Do you ...
0
votes
0answers
30 views

2D Voxel Game Chunk Question

I'm currently working on a 2D Voxel game. I started with a big blocks array with all blocks inside it, but it is not very good for performance, so I'm currently switching over to chunks. My question ...
0
votes
1answer
43 views

Libgdx fix small objects on android devices

I'm having issues with optimizing my game for android. I've basically created a simple menu with two buttons (see pictures below)! The size of the window is 720x480px ( in the Desktop Launcher ). My ...
0
votes
0answers
48 views

libGDX render 2 tiled maps at different coordinates

I am currently learning libGDX and I want to make a game that loads multiple tiled maps and renders them. This is what I have now: public class PlayScreen implements Screen{ private Main game; ...
1
vote
0answers
18 views

Multiple bodies or multiple fixtures for a wall in Box2D?

I am making a game with a sort of "playfield" where the game takes place, acting as boundaries on a top-down shooter. I am using Box2D for physics, and I am questioning which of the following would be ...
0
votes
1answer
39 views

How to Create levels in game in libgdx [closed]

I am create trying to create a Android game using Libgdx. I want to Create levels in game . So what i do. Which classes i need to use and how to create them explained. Plz help.Also i want to add ...
1
vote
1answer
113 views

Texture Packer - Any way to make it combine intelligently

I am making a Pokemon Clone, using libgdx. I have the different types of sprites: e.g. Back, front, back shiny, and front shiny. The current way the Texture Packer combines the textures seems to be ...
0
votes
0answers
18 views

How can I switch between Stages in Libgdx?

Hello I used Stage for my menu, because this way I could add my whole UI to a CompositeActor and get the buttons, as was suggested to my in Overlap2Ds forum. Getting the button and etc works right ...
3
votes
1answer
31 views

Libgdx - GLSL shader which uses mod doesn't seem to work properly on android

Through trial and error I've managed to come up with a scanline-ish shader I'm satisfied with. On my desktop testbed it looks like this: Basically, every 2nd(vertical) pixel is darkened. However, ...