Quantcast
Channel: Question and Answer » libgdx
Browsing all 434 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

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 Article


In 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 Article


LibGDX , 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 Article

LibGDX : 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 Article

Why 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 Article


Image may be NSFW.
Clik here to view.

LibGDX 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 Article

Image may be NSFW.
Clik here to view.

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 and...

View Article

Why 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 Article


How 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 Article


How 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 Article

Implementing 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 Article

Java 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 Article

Run 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 Article


Image may be NSFW.
Clik here to view.

Libgdx 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 Article

Image may be NSFW.
Clik here to view.

How 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 Article


How 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 Article

Java 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 Article


unable 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 Article

Image may be NSFW.
Clik here to view.

TiledMap blocks makes Animation invisible

////////////////////////////////////////////////////////////////////////////////// Got it fixed. Thanks to anyone who tried to help me. New Code: mapManager.render();...

View Article

How 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
Browsing all 434 articles
Browse latest View live