LibGDX/Java – Trying to find the vector from one object to another
I want to add springs in my game that work like the ones in sonic – i.e. if you can’t get over an obstacle you have to hit a spring which sends the main character flying towards another spring that...
View ArticleIn Eclipse using libgdx, what does “project description file is missing” mean?
In a sudden case of nostalgia, I switched my eclipse workplace from my working libgdx projects to an older one. After looking through my old stuff I had some problems switching it back, since I didn’t...
View ArticleLibGDX , Box2D body Mass Center
I am creating complex bodies using this editor. But the mass center of the body is not in the right place , when I apply force to it it begins rotating . So I am confused why is the masscenter in the...
View ArticleLibGDX : Scene2D ScrollPane
I want to create a list of buttons with ScrollPane , but I cant create a ScrollPane . In the constructor method in the examples Skins are used (.atlas , .json files) but how to create these files? Skin...
View ArticleWhy should i set glClearColor and setProjectionMatrix in render method many...
import com.badlogic.gdx.Game; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.g2d.SpriteBatch; public class MyGame extends Game { public OrthographicCamera camera;...
View ArticleLibGDX obstacle collision
How can I handle collisions with obstacles in LibGDX? Is there any automatic way to stop the character’s movement when it collides with a wall or I have to constantly poll for all the possible objects...
View ArticleLibGDX – 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 and...
View ArticleWhy does physics interpolation give me periodic jumps/flickers?
I have seen this question but it didn’t solve the problem. I have followed the same steps as in this article. What I notice in my Android game is that my interpolation alpha (or fraction or...
View ArticleHow to run a method after a scene2d being rendered in libGDX
I want to make a screenshot with ScreenUtils.getFrameBufferPixmap(x, y, w, h); I call this function in Actions.run(new Runnable{…}) in scene2d.ui, and the problem is that actions are called at very...
View ArticleHow to stop deltaTime while debugging
Framework: LibGDX IDE: Android Studio Game based on Kilobolt tutorial While debugging, the frame delta time i get using Gdx.graphics.getDeltaTime()continues to increment so when i stop debugging and...
View ArticleImplementing Spine animations in Libgdx
I’ve been searching a lot for a guide on how to implement 2D animations exported from Spine to Libgdx, but all I could find was outdated tutorials and source codes. I can handle basic Libgdx but Spine...
View ArticleJava libgdx Game Screens and rendering tile map [closed]
I’m working on a 2D tiled game with Java and libGDX. I’m having problems implementing gamescreens. I’m trying to set the screen to gameScreen and start rendering tiles, but I’m getting a nullpointer...
View ArticleRun one cycle of animation when button is pressed in libgdx
I am looking for a way to run my animation a complete cycle when a button is pressed. The animation runs as long as the button is pressed but the animation takes a second to play so it becomes too...
View ArticleLibgdx polygon ratating
I’m using polygons for collision detection. Here is the code: poly = new Polygon(verticies); poly.setOrigin(100,100); poly.setRotation(45); renderer.setColor(Color.GREEN);...
View ArticleHow do I use Libgdx viewport for UI?
I am using LibGDX to make a game for Android and I am using 2 Viewports. One for UI and one for the actual game content. My problem is I can’t find a good way to scale my UI using a Viewport. This is a...
View ArticleHow can I use OpenType Font in libGDX
Is there a way I can use an OTF file with libGDX. The following throws an exception: gameFont = new BitmapFont(Gdx.files.internal("data/font.otf")); Caused by:...
View ArticleJava Libgdx: How do you add cells to a TiledMap?
I’m trying to make a Side-Scrolling game that will allow you to place/remove tiles. I’m using the TileMap Editor to render the custom Tilemap but is there any way to add tiles? I have it where I can...
View Articleunable to use two gestures simultaneously
I have a class implementing gesture listener in libgdx. I want to use longpress gesture in one half of the screen and fling gesture in other part of the screen simultaneously. public class FlingHandler...
View ArticleTiledMap blocks makes Animation invisible
////////////////////////////////////////////////////////////////////////////////// Got it fixed. Thanks to anyone who tried to help me. New Code: mapManager.render();...
View ArticleHow can I repeat a Texture Region in libGDX
I have a texture that is part of a sprite sheet. I want draw the texture to cover a certain length, but I want it to repeat not stretch. However,when I use the following code batch.draw(hillBottom,...
View Article