Tag Info

Hot answers tagged

2

It means desktop. You have two options to deploy your libGDX app to the desktop: Create a self-runnable JAR. This is easier (Eclipse can export it pretty easily). Create an EXE, via launch4j (or some other wrapper). This is possible too (especially with Gradle). I've used both approaches and they work equally well as far as I can tell. Both rely on ...


2

Your server is more authoritative than it needs to be. The client needs to start moving as soon as the button is pressed, so there is no perceived lag. The server can then essentially replicate packets for other players, (maybe run a physics-sanity-check against a stored world model to prevent cheating, like warping through walls and such). Time stamping the ...


1

Imagine the radius is one. That means every point around the circle is exactly one unit away from the center. Now what kind of vectors always have a length of one? Unit vectors of course. You can get a unit vector by normalizing a non-unit vector. Take the vector CA (center to A). Next, normalize CA to make it a unit vector, then scale it by the radius of ...


1

You could try using a Camera when drawing your images. Create a new OrthographicCamera like so: OrthographicCamera cam = new OrthographicCamera(VIRTUAL_WIDTH, VIRTUAL_HEIGHT); Now when you create your viewport, pass the camera into the constructor. Viewport viewport = new FitViewport(VIRTUAL_WIDTH, VIRTUAL_HEIGHT, cam); Now in your render method: ...


1

This is very simple, actually. You don't need to translate the camera (that is dealing with Matrices, I think?) using the "translate" method. You can simple set the camera's position to your sprite's position (assuming you use the x-y coordinates where (0, 0) is the bottom-left corner. Or extend the "Sprite" class; either way should work). In your camera ...


1

I have never used a viewport without a stage, but replacing width and height with the calls to Gdx.Graphics.getHeight/getWidth that you are using causes the same behavior you are experiencing. Removing those calls and using the passed values should fix your problem. public void resize(int width, int height){ stage.getViewport().update(width, height, ...


1

Unfortunately, there is no magic: the only good way is to implement resolution independence yourself. While libgdx may be of some help, it's not going to solve your every problem. For my NoThree puzzle game (see profile for link), I drew my graphics in Inkscape and I exported several resolutions (144x144, 72x72, 48x48) for each texture (the font is also ...


1

Actually it's already present in Vector2 class. You can use something like this: Vector2 touchPoint = new Vector2(211,312); // random touch position Vector2 center = new Vector2(world.getWorldWidth() / 2, world.getWorldHeight() / 2); // center of the world float width = touchPoint.sub(center).len(); // length of resultant vector float angle ...


1

Easiest way is to set the visibility to false tiledMap.getLayers().get(index).setVisible(visible); EDIT: Reference to the libGDX API http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/maps/MapLayer.html#setVisible-boolean-



Only top voted, non community-wiki answers of a minimum length are eligible