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
1k views

Side Menu using Libgdx

I want to make it so that when the player presses start, a side menu slides out and gives a player some option on one side of the screen, similar to Angry Birds or Pokemon. I'm not sure how to go ...
0
votes
1answer
266 views

Tweening in 2d side-scrolling RPG

I'm working on a 2d side-scrolling RPG-ish game. Currently the movement of the main character(hero) is based on the A and D keys, because it's 2d and I don't really care about jumping. I would like to ...
1
vote
1answer
2k views

Registering InputListener in libGDX

I'm just getting started with libGDX and have run into a snag registering an InputListener for a button. I've gone through many examples and this code appears correct to me but the associated callback ...
0
votes
1answer
292 views

Design question: How to handle input more efficiently?

I'm designing a system to handle the keyboard input for my game. To get it more simple, I have a class that has two methods, KeyUp and KeyDown which tell me which key has been pressed, this is already ...
1
vote
0answers
82 views

How to space actors in scene uniformly? [duplicate]

I have a Array data structure right now, which contains 10 soldiers in my army. They can setup initially in various formations - e.g. o o o o o o o o o o The user can move one of the ...
-2
votes
3answers
265 views

ArrayList mixing up indexes?

Working title. I'm warming up to libgdx and I'm trying to remove objects from an ArrayList when pressed/touched. The Objects are rectangles and about 70% of them get removed, the other 30% just stays ...
0
votes
1answer
223 views

swipe effect problem using only mesh and array - libgdx

I tried to combine matdesl's and libgdx's draw lines algo ang code. but i can only create a line. problem is i want to make a fruit ninja swipe effect but only knows this... problem is i want to make ...
2
votes
0answers
262 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!
2
votes
1answer
2k views

Libgdx loading images

I can't find a sulotions that solves my problem, I've tried pretty much every tip I can find, but with no luck. Error : Exception in thread "LWJGL Application" ...
0
votes
0answers
377 views

pause or freezing game screen

I have a question regarding the pausing/freezing a game while a window/pausemenu will appear at center of the screen. I've already created a pausescreen class which will be called each time the back ...
1
vote
0answers
298 views

Libgdx: scrolling background for preview screen

Good day, I have been coding for quite a while now and I'm at an certain point where i am having difficulties on solving something. I've been creating a preview screen which contains the following: ...
1
vote
1answer
1k views

libgdx: how to manage entity classes [closed]

Good day sirs, I know this is a newbie question but I really need to ask it. I've been reading a lot of sample codes on libgdx, and I have seen entities(player, enemy, boss,etc.). my question is what ...
0
votes
1answer
770 views

Error using Physics Body Editor for LibGDX

In my game, I've been trying to use the physics body editor for libgdx, but I kept on getting an error. So I thought there was probably something wrong with my code so I took the example off of the ...
1
vote
1answer
324 views

How to properly calculate y position when drawing from .fnt bitmap font?

I want to render text to bitmap to use it later as a decal texture. I've read through libGDX fonts drawing code and came up with this: private void writeTextToPixmap(Pixmap destPixmap, Pixmap ...
6
votes
2answers
3k views

How can I post scores to Facebook from a LibGDX Android game?

I am using LibGDX to create an Android game. I am not making the HTML backend of the game. I just want it to be on the Android Google Play store. Is it possible to post the scores to Facebook? And if ...
1
vote
0answers
133 views

How to use HyperLink with Actor in Libgdx

I am making a quiz game using LibGDX. I want it to redirect to a website. I am using classes like Text and Label that extends Actor to write text using a bitmap Font. I have no idea on how to provide ...
3
votes
2answers
4k views

Libgdx ShapeRenderer rectangles

I'm trying to draw a filled rectangle in Libgdx and according to the API this should work: shapeRenderer.begin(ShapeRenderer.ShapeType.FilledRectangle); But it gives me an error and tells me to ...
2
votes
0answers
875 views

Libgdx ParallaxScrolling and TiledMaps

I implemented ParallaxScrolling for my SideScroller project, everything is working but the tiled map (the most important part!). I've been trying out everything but it doesn't work (see the code ...
1
vote
1answer
3k views

Implementing Scrolling Background in LibGDX game

I am making a game in LibGDX. After working for whole a day..I could not come out with a solution on Scrolling background. My Screen width n height is 960 x 540. I have a png image of 1024 x 540. I ...
0
votes
1answer
188 views

Should I make the Cells in a Tiledmap as null when my player hits it

I am making a Tile Based game using Libgdx. I took the idea from SuperKoalio platformer demo by Mario Zencher. When I wanted to implement Collectables in my game , I simply draw the coins using Tiled ...
1
vote
1answer
2k views

Setting Higher Z-Index for Sprite

For my game, I have to set highest z index for my sprite. At present, I wrote following code but didn't work for me. Sprite houseSprite = new Sprite(pX, pY, ...
0
votes
0answers
170 views

Libgdx wallpaper offset change

i have an image that i set as background. I use texture Region for my image. i put this in update method. batcher.begin(); batcher.draw(background, 0, 0, 320, 480); batcher.end(); How could ...
1
vote
0answers
304 views

Create a touchpad-joystick using texturepacker2

I am adding a touchpad control to my game, using TexturePacker for loading images into the image-atlas. I have followed this tutorial to add the joystick. Everything is the same apart from the loading ...
0
votes
2answers
208 views

How to implement a game launch counter in LibGDX

I'm writing a game using LibGDX in which I want to save the number of launches of a game in a text file. So, In the create() of my starter class, I have the following code ..but it's not working ...
1
vote
1answer
352 views

Making Ball Fling in a Curve Direction

I was wondering how to figuring out how to slice a ball (banana kick) by flinging it curve-ways. However, according to the LibGDX's gesture listener, the method for flinging only focuses on a straight ...
1
vote
2answers
1k views

Should I accumulate state time based on a global or a parameter?

Generally, we associate a "state time" with our sprites. Libgdx provides a method to do so: float deltaTime = Gdx.graphics.getDeltaTime(); However, in the main game loop, we have a delta time as a ...
1
vote
2answers
1k views

LibGDX with Android UI

Hello I want to combine between android UI and libGDX. I want to have half of my screen with libgdx engine (animated sprite) and the other half of the screen with android UI buttons. Does anybody know ...
1
vote
1answer
83 views

Images not found in textureregion

Previously I was using simple Texture for sprite based animations, but that did not provide support for images which were not in the power of 2. TexturePacker provides with the ability to load all the ...
1
vote
0answers
240 views

Texture Region drawing issue with LibGDX

I am currently moving my old slick2d project to libgdx. I have created a custom AnimationExt class that extends Animation to which I added a draw method. The Animation's frames are actually ...
0
votes
1answer
488 views

Input events not working simultaneously on android devices in libgdx

I am making a simple platform game in Libgdx... in which I have made the player to move left, move right and jump. The code works fine on Desktop but on Android devices, Jump is not fired when the ...
0
votes
1answer
86 views

Problems implementing a Sign Sprite in Libgdx

I am making a tile based game in LibGdx. I am using the TiledMap in .tmx format. I want when my player reaches a tile whose property is set (tileType -> sign), he should see a Sign sprite and on ...
0
votes
1answer
1k views

how to use texture atlas

I am trying to implement texture atlas. 1) I am using the texturepackerGUI and the result is taking 2 files , one png (whicj contains all the images and one .atlas (and not .pack). 2) Now , I want ...
0
votes
0answers
396 views

TIled map rendering in libgdx

Good day. First of all, some explanation of situation. Init tiled map code: map = new TmxMapLoader().load("maps/map.tmx"); mapRenderer = new OrthogonalTiledMapRenderer(map, 1f / 32f); Rendering ...
2
votes
1answer
443 views

Recording and playing back sounds with LibGDX

How do I record a sound to PCM format and replay it from there?
3
votes
1answer
257 views

How to setup libGDX project only for Android & iOS?

I have developed some applications on android.But now i want to learn game development in Android & iOS with libGDX. I want to only develop for Android & iPhone.I do not want a desktop ...
1
vote
1answer
2k views

how to get width and height of TiledMap in the latest Version of Libgdx

I am making a tiled based game, I want not to let the camera show places, where there is no map... this is a obvious solution I got from a tutorial if(camera.position.x<400){ ...
1
vote
2answers
878 views

How do I use TextureRegion?

I can't understand how to use texture region. I have a png file which has images (sprite sheet) and I must "extract" every image I want. From here it just says TextureRegion(texture, 20, 20, 50, ...
0
votes
1answer
704 views

adding vertical scrolling to 2D platformer in libgdx

I am trying to make a two sided platform game in Libgdx. Where I am scrolling through the TiledMap. I was easily implementing the horizontal scrolling using.. camera.position.x = ...
-1
votes
1answer
236 views

no custom background - touchdragged method? [closed]

I am beginner in libgdx and trying to experiment .I am using the simple example here .So, I have 2 questions: 1) I want to use my background picture.So, I have a class Assets where I have all the ...
4
votes
1answer
981 views

Problem Implementing Texture on Libgdx Mesh of Randomized Terrain

I'm having problems understanding how to apply a texture to a non-rectangular object. The following code creates textures such as this: from the debug renderer I think I've got the physical shape ...
1
vote
2answers
853 views

Libgdx: Am I abusing Vector2? Is there a better way to do my position updates and rendering?

I'm simulating hair in a game. Currently I have a HairField object, which has a position defined by a Vector2. Each HairField has multiple Hair objects in a list, each with a position defined by a ...
6
votes
1answer
1k views

Generating a physics body for 2D Worms-like Terrain

I wrote a processing sketch that generates hills for a scorched earth clone, like this: I'm trying to figure out how to make this a physics object in libgdx, but I'm having problems figuring out ...
0
votes
1answer
355 views

Moving a Box2D object in the direction it is facing using applyForce [duplicate]

I'm trying to apply force to a polygon physics object to move it. Whilst I can get it to move upwards easily enough, I'm trying to get it to move in the direction in which it is pointing. Here's my ...
0
votes
1answer
388 views

Libgdx: setting windows's icon

When I export my game as runnable .jar file with custom window's icon - it doesn't run. It runs only in debug mode and when I try to launch .jar with console it says that it cannot load icon file. ...
-2
votes
1answer
139 views

How do I make a button that can only be pressed once / you can't hold it [duplicate]

I've created a button by checking if the left mouse button is being pressed and the cursor x/y are in the boundaries of the button but the issue is that if you even hold it down for longer than a ...
0
votes
0answers
108 views

libGDX TileMapRenderer not doing anything

I was using this tutorial and tried to make the TileMapRenderer work, but I can't. It never renders anything, no matter what i do. EDIT: I found out that the problem has nothing to do with the code. ...
6
votes
1answer
1k views

How can I achieve smooth shading / glow from one tile to another?

I've been working on a tile-based game in which some areas may be lit (currently seen), some may be black (never seen) and some may be dark (previously seen, but not currently seen). Looking at the ...
0
votes
1answer
224 views

questions about position and size

I am new to game development and I wanted to ask a question. I am reading the simple game example from here. 1) I want to ask why we define bucket.x = 800 / 2 - 48 / 2 ? How is that? Why not just ...
1
vote
1answer
307 views

Dealing with “jumping” sprites: badly centered?

Thing is, I've used darkFunction Editor as a way to get all the spriteCoordinates off a spriteSheet for each individual sprite, and parse the .xml it generates inside my game. It all works fine, ...
1
vote
1answer
90 views

Black areas on different screen sizes

I'm currently facing some problems with sprites/images on different screen sizes. For now the game stage is stretched to maximum width and height of the screen. In Samsung Galaxy S2, SGS3 and SGS4 ...