Body lost a velocity component when hitting a wall
I am creating a Breakout game using Box2D (of LibGdx if anyone interest). Everything works well until when the ball hits the wall when moving with a very small angle. Please look at the image for...
View ArticlelibGDX SpriteBatch.draw() origin not working as expected
I’m having a weird issue with SpriteBatch.draw(). I’m using the Ashley Super Jumper demo (https://github.com/siondream/ashley-superjumper) as the basis for my code. Here’s the render queue: for(Entity...
View ArticleWhy table in libgdx game give wrong position
Can anybody guide me, I am creating a table in libgdx game on menu screen to set different buttons on my screen. here is the code for table draw table.setBounds(0, 0, Gdx.graphics.getWidth(),...
View ArticleArtefacts when drawing textures
I am working on a level-based android game. The level is constructed of many blocks, all drawn with the same texture. Until now I didn’t have any problems with drawing the different textures next to...
View ArticleLibgdx Sprite is not drawn when generated inside another class
I´ve built a gameloop where I generate new items depending on the elapsed time and want to place them somewhere on the screen. I use some randomness for the color and coordinates. For better design I...
View ArticleLibGDX how to efficiently handle button presses
I’m making a simple 2D game for android using LibGDX. My game needs to have many buttons in it that fire off a method when pressed, and I was wondering what the best way to do this would be. I tried a...
View ArticleIs there any case to mix Android UI with LibGDX?
my question is about creating “non-playable” screens in games with the help of native android tools. For example, I have an Android LibGDX game (singleplatform), what should I use to provide start...
View ArticleLibgdx – How to change GestureListener pan finger sensibility?
I implemented GestureListener in my Overlap2dStage to pan the camera when the player drags its finger over the screen. But I also have some actors that extend InputAdapter to detect when the user...
View ArticleLibGDX collision with rectangle and circle
I have 2 objects, A and B, both are classes with only values, so positions and dimensions are only values (float posX,posY). I have a render class which render A and B with shapeRenderer; A is rendered...
View ArticleLibGDX – Show a minimap
I’ve started to develop a small roguelike game in LibGDX. I’ve also made a minimap class, which creates and updates the minimap as the player explores the dungeon, by using a Pixmap. The minimap class...
View ArticleLibgdx – Jumping, What am i doing wrong?
I really can’t work out whats wrong with my code. I have an input listener for gestures, when I Swipe the position goes up on the y axis fine but he doesn’t come back down, if with Gravity added. I’ll...
View ArticleLibGDX's particle emitter – Multiple particles in the same effect?
Hello everyone reading this, I’ve used the particle editor to edit an effect to put in my game. Is it possible to have multiple and randomly emitted images (particles) instead of one? I don’t want to...
View ArticleLibgdx detect touch on a specific object (while moving) [closed]
I have a class (I’ll call it with letter “A”) and class B. A is the object (as a character) and B is the rendering class which have the aim to show A. I am looking for a way to detect when A is...
View ArticleLibgdx bouncy effect in a wall
I have an element inside the screen and I want to set my phone’s bounds as a wall where elements are bouncing. I want it to be physically correct. How to do this?
View ArticleLibgdx array of Vector2 closest point
I have an array of objects. Their position is a Vector2 (x, y). I want to select the closest object, given a (x, y) coordinate (that represents an user touch on screen). Searching on web I found a few...
View ArticleActor not taking touch libGDX
I am trying to handle the touch of one of the Actors in the stage. The following is the code I have written: public class MyGame extends ApplicationAdapter { private GameStage gameStage; //Game stage...
View ArticleIs there a way to capture back button twice in same activity libgdx game
Can anybody tell me if there is a possibility to capture back button twice in same activity in libgdx. What i want to achieve is that if the user press back button once the game pause. if in the pause...
View ArticleCreating a Melee Weapon in Box2D (libGDX)
I am struggling with how to implement a melee weapon that can swing when a key is pressed. I am imagining two different attacks (stab and swing) I have tried creating two fixtures (character + weapon),...
View Articlebox2d not centered in sprite [duplicate]
This question already has an answer here: Why is my sprite displayed offset from its Box2D body? 1 answer
View ArticleImages not scaling properly in LibGDX when using...
I am trying to put Assets into my game but when i put in the line of code “batch.setProjectionMatrix(camera.combined);”, which from my knowledge scales the Asset to the size of the window it appears...
View Article