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

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

Hello I have made a game in 1280×720, 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...

View Article


Image may be NSFW.
Clik here to view.

Textures created with Photoshop show up with a white border

All of a sudden, I started having this problem. I’ve used libGDX + Photoshop before and never had this problem. One of my textures is showing up with a white border/glow around. The texture is the...

View Article


Image may be NSFW.
Clik here to view.

How to run Kryonet server inside Libgdx project and is it ok?

I am trying to add multiplayer to my game and I used Kryonet. I have written the server, requests and etc and the only thing that is in front of me is how to run the server, it is in the libgx project...

View Article

Image may be NSFW.
Clik here to view.

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

View Article

How to convert velocity (Vector) to m/s (Scalar)

I have a variable called velocity which I get from a dynamic body in Box2D. It is the velocity of a pirate ship and when I add torque to the ship I want that to be proportional to the speed (m/s – 10px...

View Article


Image may be NSFW.
Clik here to view.

Dealing with collisions across adjacent static bodies

The Problem: I have the following setup: A, B and C are rectangular static bodies in box2d. p is a circular dynamic body in box2d. The movement of ‘p’ is solely controlled by the current gravity force...

View Article

How to render Fonts with correct size?

I’m making a game using libgdx and box2d so my Orthographic Camera Viewport is only 20×12 pixels/meters, when I try to render the a font on screen it becomes really big and pixelated, I also tried to...

View Article

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

View Article


Image may be NSFW.
Clik here to view.

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)){ }...

View Article


Libgdx: move img from one point to another?

I’m trying to make an image move towards another point. I only have the current X/Y and the destination X/Y + Speed. That’s it. public void Draw(SpriteBatch batch, int goalX, int goalY){ destX = goalX...

View Article

libGDX –“Hosting” a Viewport inside of a Scene2d Window

I am making a game using libGDX. I am trying to build some tools to use while developing my game, things like a scene editor or a scripting console. The tools are Scene2d widgets which I have in a...

View Article

Vertically mirroring the screen in LibGDX

I’m developing a game in which the screen layout is different for right and lefty players, so i’ll put a button in it to mirror the screen vertically. For displaying textures and fonts, i use a single...

View Article

Image may be NSFW.
Clik here to view.

How do I induce collision events in LibGDX 3D?

In the code below I’ve put an example of something I want to do. I have the camera and I want it to stop moving whenever it hits one of the boxes, how do I do this? public class Main extends...

View Article


libGDX best way to do Game States

I’m making a JRPG in libGDX, and I’m working with Screens. I have a main Screen called GameScreen, a screen for battles called BattleScreen and I want to make a screen for managing party members and...

View Article

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

View Article


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

View Article

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

View Article


Image may be NSFW.
Clik here to view.

Box2D is not positioned on the sprite correctly LibGDX

I have a strange issue where my Box2D is not being positioned on the player correctly. Down is the picture: What I find more strange is that the Box2D is positioned correctly on the cloud that is below...

View Article

Image may be NSFW.
Clik here to view.

Why is my character passing through in Box2D?

I have a collision problem in Box2D. I am trying to do a simple platform game with Libgdx, Box2D and TiledMap. I have a map made with TiledMap: I load the map in my Android game. I read all the...

View Article

libgdx – Math reflection to the correct direction

I’m using a simple reflection system, but the game doesn’t work how I want. How should this game work? The game has two boxes. A red side and a black side. The player should only sort the bombs to the...

View Article
Browsing all 434 articles
Browse latest View live